I am attempting to start a project in Arduino in which a single button could be pressed and start a timer with a preset value, count down and output a tone that I can run into an amplifier. I need two preset times of 3 minutes and 5 minutes and would also like a display to show how much time is remaining on that cycle. What would the best way be to accomplish these tasks? I'm new to arduino but not electronics so a handy nudge would be appreciated!
I am attempting to start a project in Arduino in which a single button could be pressed and start a timer with a preset value, count down and output a tone that I can run into an amplifier. I need two preset times of 3 minutes and 5 minutes and would also like a display to show how much time is remaining on that cycle. What would the best way be to accomplish these tasks? I'm new to arduino but not electronics so a handy nudge would be appreciated!
The StateChangeDetection examples shows how to indentify when a switch is pressed or released. When that event occurs, you can record the current time with millis(). Within your loop function, you can subtract the previous recorded value from the current value of millis() to get a time elapsed in milliseconds. Some simple arithmetic will get you minutes/seconds. sprintf() can be used to format and display the minutes/seconds.