I am very new to using arduinos, and I have taken on this project.
It is meant to be a game clock for the game Go. In one of my functions, everything works up until it hits the while loop. After that, I am not sure why it doesn't keep displaying new numbers as it is counting down. I will post the function I am having trouble with along with the setup() method, because I am using those two to try and troubleshoot.
# include <LiquidCrystal.h>
const int playerButton = 13;
LiquidCrystal lcd(0, 1, 8, 9, 10, 11);
int minsWhite = 10, secsWhite = 0, periodWhite = 5, periodWhiteSecs = 30;
int minsBlack = 10, secsBlack = 30, periodBlack = 5, periodBlackSecs = 30;
char timeline[16];
//BLACK AND WHITE TURNS CODE HERE
void blackTurn(){
int blackMinutes = minsBlack;
int blackSeconds = secsBlack;
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Black Playing");
lcd.setCursor(0, 1);
sprintf(timeline, "%0.2d mins %0.2d secs", blackMinutes, blackSeconds);
lcd.print(timeline);
delay(1000);
while(blackMinutes > 0 and blackSeconds >= 0){
blackSeconds--;
if(blackSeconds < 0){
blackMinutes--;
blackSeconds = 59;
}
lcd.setCursor(0, 1);
sprintf(timeline, "%0.2d mins %0.2d secs", blackMinutes, blackSeconds);
delay(1000);
}
}
void setup() {
pinMode(playerButton, INPUT);
lcd.begin(16, 2);
lcd.print("Black Plays");
//CALLING FUNCTION TO TEST HERE
blackTurn();
}