I am writing code for a countdown timer, and I would like to have one button which when pressed will start the loop that counts down, and when I press it again it will reset the loop and be ready for when I press it again to start the loop again. Could anyone give me an example code to accomplish this?
An added bonus would be if someone could help me with having the Arduino sleep until I press the button to start the timer, then when I press the button it resets the program and puts the Arduino to sleep again.
Thanks so much. This is my first time coding.