Last active
February 28, 2022 23:34
-
-
Save MxBoud/c02001730d7e1aedbbfd030f6aa52977 to your computer and use it in GitHub Desktop.
Troubleshooting for BOB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Modify feb 28/2022 MB | |
long lastTime = 0; | |
long seconds = 0; | |
long minutes = 0; | |
long hours = 0; | |
long myTime1; | |
//#include <LiquidCrystal_I2C.h> | |
//LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display | |
void setup() { | |
Serial.begin(9600); | |
//lcd.begin(16, 2); | |
//lcd.init(); // initialize the lcd | |
// lcd.backlight(); | |
} | |
void loop() { | |
//A chaque fois que tu avais plus grand que, j'ai changé pour plus grand ou égale que. Tu veux que la minut echange aussitôt que tu es | |
// a 60, et non pas quand que tu dépasse 60 | |
if(millis()-lastTime >=1000 ){//Modify from 1000 to 999 to get closer from clock time. | |
seconds++; | |
lastTime = millis(); | |
} | |
if(seconds >= 60){ | |
minutes++; | |
//minutes = 0; | |
seconds = 0; | |
} | |
if(minutes >= 60){ | |
hours++; | |
lastTime = millis(); | |
minutes = 0 ; | |
} | |
//Serial.println(hours);//Premiere erreure -il faut mettre Serial.print et non Serial.println (pour que ca reste sur la meme ligne) | |
Serial.print(hours); | |
Serial.print(":"); | |
Serial.print(minutes); | |
Serial.print(":");// J'ai ajouté cette ligne | |
Serial.print ( seconds ); | |
//Serial.print(myTime1); Cette ligne est pas nécessaire | |
//Maintenant, c'est important d'avoir une commande pour changer de ligne pour la prochaine fois. | |
//C'est possible avec Serial.println(empty string) | |
Serial.println(""); | |
/* | |
lcd.setCursor(14, 0); | |
lcd.print(seconds); | |
//lcd.print(":"); | |
lcd.setCursor(10, 0); | |
lcd.print(minutes); | |
lcd.print(" :"); | |
lcd.setCursor(6, 0); | |
lcd.print(hours); | |
lcd.print(" :"); | |
*/ | |
} | |
//Merci | |
//POPA | |
//Cela fait plaisir! | |
//Maxime! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment