i have this code in which a timer is implemented for 1 second and have two buttons. once the first button is pushed the timer starts, however i have added a delay(1000) so i have to hold down the button to stop the timer. i want the timer to stop with one quick push rather then holding it down. can any help me
if (buttonState == HIGH) {
unusual = 1;
check = 1;
}
if(check == 1){
digitalWrite(ledPin, HIGH);
s2++;
if(s2 == 10){
s += 1;
s2 = 0;
if(s == 6){
m2 += 1;
s = 0;
if(m2 == 10){
m += 1;
m2 = 0;
}
}
}
delay(1000); // im sure this is the issue
}
}
if (buttonState2 == HIGH && buttonState == LOW) {
check = 2;
//Serial.println("check 2 Set");
}
if(check == 2 && unusual == 1){
digitalWrite(ledPin, LOW);
delay(2000);
Serial.print(dog);
Serial.print(",");
Serial.print(m);
Serial.print(m2);
Serial.print(":");
Serial.print(s);
Serial.println(s2);
delay(500);
}