Update your browser to view this website correctly. Update my browser now
Project #31: Creating a Stopwatch
Now that we can measure the elapsed time between two events, we can create a simple stopwatch using an Arduino. Our stopwatch will use two buttons: one to start or reset the count and another to stop counting and show the elapsed time. The sketch will continually check the status of the two buttons. When the start button is pressed, a millis() value will be stored, and when the second button is pressed, a new millis() value will be stored. The custom function displayResult() will convert the elapsed time from milliseconds into hours, minutes, and seconds. Finally, the time will be displayed on the Serial Monitor.