Quote:
Originally Posted by amnonholland
Thanks a million! This will help providing an accurate readout since my OEM gauge is highly non-linear!
I have another arduino in my car hooked up to a 128x128Pixel OLED display which ill display the fuel level via a bargraph. This arduino will hopefully read the fuel level out from the mpguino via one of its analog inputs. Im amazed with the mpguino's fuel level accuracy!
What I'm really stuck with is:
1) What/where is the variable that stores the remaining fuel level?
2) Where would i locate a 'write to pin type' function? (I.e. in which block?)
3) What do you mean by write directly to pin?
Much appreciated
Let me know if I can contribute or assist the project in some manner.
Amnon
|
Initial thoughts -
You can certainly use pin 11, OCR2A, for your analog output. Keep in mind that it will only have a 8-bit resolution, though. Still, considering a 0-5VDC range, that works out to be about a 20 mV resolution.
OCR2A is driven by timer 2 on the Arduino Uno, which is also what I used for my minscheduler module. It runs at about 1024 microseconds, or at about 977 Hz.
To set the desired pulse width, you would write to OCR2A with an 8-bit value. I'd place it in the main loop, where the awake section lies. I'd also have something that wrote a zero to OCR2A when the sleep section is active, probably near the call to set the LCD brightness to zero.
In order to get the remaining fuel, you'll want to load some unsigned long variable with
Code:
value = SWEET64(prgmFindRemainingFuel, tankIdx);
and then do whatever calculations you'll need to convert that into a 8-bit value.
Let me work on it some more. I just got to be able to have a good look at the code again. It's been a while since I last looked at it... heh.