Stopwatch

Greetings all !!

I want to creates a stopwatch using Arduino Uno and displayed it on 2 of 8 digit Seven Segments. The first Seven Segment is to display the timer and the second one is to display the Lap timer. I'm stuck on my programming with creating reset button. My idea is build the stopwatch with 4 buttons for Start/Stop, Reset All, Lap Lime, and Reset Timer respectively. Start/Stop button is to start or pause the counts. The Lap Time button is for recording the lap time. The Lap Time here is works by summing the last time the Lap Time button was tapped. For example the Lap Time is tapped at 3 seconds, the second Seven Segment will displayed 3, and then at 7 seconds the Lap Time is tapped again so in the Seven Segments will displayed 10 (because 3 sum by 7 is 10) and then so on.
The Reset All button is for reset all the Timer and Lap Time records. The Reset Timer is for reset the timer only so when it was activated, the Timer will return to zero and the count will start from zero again, but the lap Time is not affected and automatically resuming the Lap Time summing programs. I am stuck in using the Reset Timer programming. can you help me fix it? So when the Reset Time button is activated, it's only reset the Timer and the Lap Time summing program is still continue.

Thank You!

Lap_Timer2.ino (3.8 KB)

You are stuck indeed :cry:
Suppose there is some kind of dirty and sneaky way to fix it, then you will be stuck again if you want to add or change something.

Are you willing to abandon your sketch and start all over ?

You run the timer with a for-loop with a delay inside the Arduino loop() function.
We don't do that. We let the Arduino loop() run as fast and as many times as possible. For example 1000 times per second.
The Bounce2 library will work better that way and then it is possible to use software timers with millis().

With millis() the stopwatch will be accurate.
With a Finite State Machine, you can make everything you want in code.

To start with millis(), study the Blink Without Delay page: https://www.arduino.cc/en/tutorial/BlinkWithoutDelay.

I don't know if a Finite State Machine is necessary. You could have a look at a tutorial to see if you like it: The Finite State Machine | Majenko Technologies.

I have not made a stopwatch example yet. You can have a look at a few of my examples to see millis() and also a few Finite State Machine sketches: Fun_with_millis.

Please show a sketch in your post between code tags.

Thank you for your replies.
I will try those suggestion and abandon all my sketch.
I will start it over again.

Once again, thank you very much!