Now that we can measure the elapsed time between two events, we cancreate a simple stopwatch using an Arduino. Our stopwatch will use twobuttons: one to start or reset the count and another to stop counting andshow the elapsed time. The sketch will continually check the status ofthe two buttons. When the start button is pressed, a millis() value will bestored, and when the second button is pressed, a new millis() value willbe stored. The custom function displayResult() will convert the elapsed timefrom milliseconds into hours, minutes, and seconds. Finally, the time willbe displayed on the Serial Monitor.

Components REQD.:

 

1) Arduino Board + USB Cable

2) Breadboard

3) Jumper Wires

4) Pushbutton [x2]