Hi
I'm after some help please. I'm trying to produce a lap timer for a car and while i'm not concerned with the hardware as such right now I am trying to get the basic software/program sorted.
What I'm doing is using a 20x4 lcd, which i can communicate with so no problems there, its just the code.
The code I can't work out is just the timing code. I can count fine with seconds, 10th and 100th's of seconds. What i am having problems with is 10s of seconds as they count up to 99 and not 60 (or 59). I would like to get this sorted then i can play with other settings.
If the code i'm using wont suffice, then i'll have to look elsewhere but its the best i have found and to understand at my level at the moment.
#include <LiquidCrystal.h>
int long aa ;
boolean b=true;
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
void setup() {
lcd.begin(20,4);
lcd.print("Current Lap");
}
void loop() {
if(b){
lcd.setCursor(12, 0);
aa=millis(); // collecting time from millis function
lcd.print((aa/1000000)%10);
lcd.print((aa/100000)%10);
lcd.print('.');
lcd.print((aa/10000)%10);
lcd.print((aa/1000)%10);
lcd.print('.');
lcd.print((aa/100)%10);
lcd.print((aa/10)%10);
if(aa>=128000){
delay(20);
lcd.setCursor(0,0);
lcd.print(" IT WORKS, YEY ! ");
for(int i=0;i<3;i++){
lcd.noDisplay();
delay(750);
lcd.display();
delay(750);
}
b=false;
lcd.clear();
}
}
if(!b){
lcd.setCursor(0,0);
lcd.print("www.diymaker.com");
}
}
All help appreciated