Quote:
Originally Posted by amnonholland
A warm thanks from Canberra, Australia to all those who have contributed to the mpguino project and in particular to tvago for the amount of time invested in developing this excellent tool!
A quick question for somebody with coding background - my mechanical engineering background does not help me here!
Im trying to write out a 0-5v signal on the UNO pwm pin with the fuel level to go to another ext gauge.
I have tried analogWrite(11, gallons()); after converting to integer ( int val = (int) gallons(); ?) but am not getting anywhere. Understand I need a low pass filter to convert to true analog. Im not really sure what variable i need to call up (which stores the tank remaining value) or where's best to put this line in the program (under mainloop?)
Any help would be appreciated. Thanks alot!
|
Thanks for the kind words!
My fork of the MPGuino code does not use analogWrite(), since I could not get it to play nicely with the miniature task scheduler routine that I wrote to coordinate all of the background tasks. Plus, I think I shaved off something like 400 bytes or so. Direct pin writes are necessary, and are used for contrast and brightness control on the LED display.
The actual write itself is pretty easy and straightforward, but setting up might take a little effort. I'll look into this and get back to you within a day.