Voici la suite 2 de 3
le 3ième suit:
/* Chrono START/STOP/LAPS
- Develop by S.Barbeau March 2010
// SECOND PART ---- Deuxième partie ------------
/------------- STOP then display time & RESET ----------------------------/
else if (buttonState == LOW && lastButtonState == HIGH && blinking == true){ // check for a high to low transition if true then stop the clock and report
//Serial.print(" B0 r ");
//elapsedTime = millis() - startTime; // store elapsed time
if (previousMillis1 ==0) { // to correct the delay comming from Processor and start button 0 push
previousMillis1 = startTime;
}
elapsedTime = (millis() - (previousMillis1)); // store elapsed time starttime
centitot1 = (elapsedTime%1000)/10 ; //centieme to display
secotot1 = (elapsedTime/1000)%60 ; // second to display
minutot1 = (elapsedTime/1000)/60 ; // minute to display
blinking = false; // turn off blinking, all timing done
lastButtonState = buttonState; // store buttonState in lastButtonState, to compare next time
// Report elapsed time on LCD
//
lcd.setCursor(8,1); // Set cursor position on LCD
if (minutot1 <10) { //If less then 10 minutes display need ajustement
lcd.print("0"); // Add a zero for clean presentation
}
lcd.print(minutot1); // Display minutes
lcd.setCursor(10,1); // Set cursor position on LCD
lcd.print(":");
lcd.setCursor(11,1); // Set cursor position on LCD
if (secotot1 <10) { //If less then 10 seconds display need ajustement
lcd.print("0"); // Add a zero for clean presentation
}
lcd.print(secotot1); // Display Second
lcd.setCursor(13,1); // Set cursor position on LCD
lcd.print(".");
lcd.setCursor(14,1); // Set cursor position on LCD
if (centitot1<10) { // If less then 10 hundreds display need ajustement
lcd.print("0"); // Add a zero for clean presentation
}
lcd.print(centitot1);//Display Hundred
// send the last run to eprom memory after the start stop button press
EEPROM.write(addr++,minutot1); // write minutes to eprom
nbrenr++; // incrementation of the number of eprom memory used
EEPROM.write(addr++,secotot1); // write secondes to eprom
nbrenr++; // incrementation of the number of eprom memory used
EEPROM.write(addr++,centitot1); // write hundred to eprom
nbrenr++; // incrementation of the number of eprom memory used}
// Detect BUTTON1 /LAP Display lap timming without stoping counting //////////////////////////////////////////
else if (buttonState1 == LOW && lastButtonState1 == HIGH && blinking == true){ // check for a high to low transition on button1
if (previousMillis1 ==0) { // to correct the delay comming from Processor and start button 0 push
previousMillis1 = startTime;
}
elapsedTime = (millis() - (previousMillis1)); // store elapsed time starttime
previousMillis1 = millis();
//
centitot1 = (elapsedTime%1000)/10 ; //centieme to display
secotot1 = (elapsedTime/1000)%60 ; // second to display
minutot1 = (elapsedTime/1000)/60 ; // minute to display
//
blinking = true;
lastButtonState1 = buttonState1; // store buttonState in lastButtonState, to compare next time
//
lcd.setCursor(0,1); // Set cursor position on LCDlcd.setCursor(8,1); // Set cursor position on LCD
if (minutot1 <10) {
lcd.print("0");
}
lcd.print(minutot1); // Display minutes
lcd.setCursor(10,1); // Set cursor position on LCD
lcd.print(":");
lcd.setCursor(11,1); // Set cursor position on LCD
if (secotot1 <10) {
lcd.print("0");
}
lcd.print(secotot1); // display Seconds
lcd.setCursor(13,1); // Set cursor position on LCD
lcd.print(".");
lcd.setCursor(14,1); // Set cursor position on LCD
if (centitot1<10) {
lcd.print("0");
}
lcd.print(centitot1); // Display Hundred//
EEPROM.write(addr++,minutot1); // write minutes to eprom
nbrenr++; // incrementation of the number of eprom memory used
EEPROM.write(addr++,secotot1); // write secondes to eprom
nbrenr++; // incrementation of the number of eprom memory used
EEPROM.write(addr++,centitot1); // write hundred to eprom
nbrenr++; // incrementation of the number of eprom memory used
}