hi guys i need help with my codes if i press the StartButton the counter working fine but if i press the PauseButton i need it to press 3 - 5 time to make my counter pause. i dont know what is the problem in my code.
// Button pin Settings
int StartPin = 12;
int PausePin = 13;
int StartButton = 0;
int PauseButton = 0;
// Default Counter
int Counter = 24;
int Running = false;
void setup(){
pinMode(StartPin , INPUT_PULLUP);
pinMode(PausePin, INPUT_PULLUP);
}
void loop() {
Count();
Start();
Pause();
StartButton = digitalRead(StartPin);
PauseButton = digitalRead(PausePin);
if (Running == true && Counter > 0) {
delay(1000);
Counter --;
}
}
void Start() {
if (StartButton == LOW){
Running = true;
}
}
void Pause(){
if (PauseButton == LOW){
Running = false;
}
}