View Single Post
Old 10-04-2008, 06:18 PM   #734 (permalink)
ac7ss
EcoModding Lurker
 
Join Date: Sep 2008
Location: Olympia, wa
Posts: 96

Red Beast - '82 Honda V45 Sabre Vetter Fairing
90 day: 39.38 mpg (US)

The Wife's bike - '82 Honda CM450E Red
90 day: 57.22 mpg (US)

Yellow Submarine - '04 Dodge Neon SXT
90 day: 28.71 mpg (US)
Thanks: 6
Thanked 1 Time in 1 Post
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.
__________________

Last edited by ac7ss; 10-04-2008 at 07:06 PM.. Reason: Bad logic.
  Reply With Quote