Up and running with 0.74.
Speed is now LESS consistent than before. (I have tried VSS delay at 1 2 and 3.) The old way worked for me. Can we get a "#define" to go back?
I was thinking about adding code for a 'Red / Green' indicator (2 LEDs hooked up to the outputs) Red would come on if instant was lower than Tank, Green would come on if instant was higher than current. Check to see if backlight was not 0 before turning the light on.
Code:
// in header section
#define GreenLed 10
#define RedLed 11
...
// in setup()
pinMode(GreenLed,OUTPUT);
pinMode(RedLed,OUTPUT);
...
// After sei() call in loop()
if(lastActivity != nil){
if(instantmpg()>current.mpg()){
//turn on GreenLed
digitalWrite( GreenLed, HIGH);
}else{
//turn off GreenLed
digitalWrite( GreenLed, LOW);
}
if(instantmpg()>tank.mpg()){
//turn off RedLed
digitalWrite( RedLed, LOW);
}else{
//turn on RedLed
digitalWrite( RedLed, HIGH);
}
}else{
//turn off both lights if we are in sleep mode.
digitalWrite( RedLed, LOW);
digitalWrite( GreenLed, LOW);
}
Please check the code, I think this is right. Now just install 2 led's on the 10 and 11 pins with drop resistors.