i need help if possible, im doing a countdown timer that uses 3 buttons 2 buttons one is to set seconds( and other to set minutes, that uses variables int Stime = 60; int Mtime = 0; all is working fine the only part im missing out is that, lets say i set time for 00:05 it will start count down at 00:60 i see whats the problem is just cant figuer out how to fix, if any help would be apreciate
here is the code that does the countdown
case 4:
lcd.setCursor(0, 0);
lcd.print("uV Light Time");
for (Stime = 0; Stime >= 0; Stime--) {
if (Stime < 10&&Mtime==0) {
tone(Buzzer, 440, 200);
}
lcd.setCursor(0, 1);
if (Mtime < 10) {
lcd.print(0);
}
lcd.print(Mtime);
lcd.setCursor(2, 1);
lcd.print(":");
if (Stime < 10) {
lcd.print(0);
}
lcd.print(Stime);
lcd.print(" ");
delay(1000);
digitalWrite(led, HIGH);
if (Stime == 0 && Mtime == 0) {
digitalWrite(led, LOW);
lcd.clear(); Set_state(5);
}
else if (Stime == 0) {
lcd.print(Mtime);
lcd.print(":");
lcd.print(Stime);
Mtime = Mtime - 1;
}
}
break;