If you do try the analog buttons, don't use that R-2R thingy in the other thread - I could not get it to work at all on my Arduino Uno. I suspect it was because the internal pullup resistor in my chip was sufficiently different from
nickdigger's setup - those things can vary by as much as 20 kohm, I've read. So,
I went with a more traditional setup. Instead of the resistance values at that link, I used what I had available in my resistor bin - 1K, 2.2K, 4.7K, 10K, 22K, and 47K. I used 1K for R1, 2.2K for R2 (which was button 1), 4.7K for R3 (button 2), 10K for R4, (button 3), and so on.
I agree that it'd be neat to calibrate the fuel gauge against what the MPGuino read out. It'd just be necessary to be able to ensure that the voltage coming off of the gauge resistor would not exceed 5 VDC, in addition to ensuring that you'd get a variable voltage off the circuit. Should be rather simple to implement, really. My code is set up so that all you have to do to read an analog voltage value is to do something like:
Code:
unsigned int v = analogValue[channel];
Was able to duplicate the button bug that
Ardent reported, and I think I figured out why it was happening. I think it has something to do with the fact that buttonState is continually updated via the main timer interrupt, and was allowed to change as it was being compared to values in the valid button press table. I modified the code to copy buttonState to another variable (gee, like the Trip values), and had the code compare that variable against the valid button press table, instead. This appears to have made the bug disappear.