Start Stop Switch issue

Hi I am hoping some one can help me,

I am building a large stopwatch and i am and stuck on the last bit of my code.
So i am using four 7-Segment Displays - 6.5" (Red) with the Spark Fun Large Digit Driver attached.

The 7 segment displays work perfectly. I have a start/stop switch attached and a reset switch attached. Now the problem i have is i cant get the stop to work.
Start works perfectly but when i hit the switch again it doesn’t stop. i am using a momentary switch
I am using the standard code for the seven segments supplied by Spark fun.

If some one could help it would be much appreciated.

Many thanks
Nick

nicks-test.ino (3.67 KB)

Did you write this code? It's attributed to Nathan Seidle.

aarg, do you have a point ? The OP said he is using the code he got from Sparkfun ?

So, it just keeps incrementing through the test pattern ?

You'll have to put a line to read the button inside your while loop.

noweare:
aarg, do you have a point ? The OP said he is using the code he got from Sparkfun ?

The point is, OP did not say if they modified it (although they did call it "my code"). That makes a huge difference in how you would offer help. Also if it was modified, it's not cool to post your own code publicly with someone else's name on it.

Who cares if he modified it, it's open source. smh.

noweare:
Who cares if he modified it, it's open source. smh.

Open source is not carte blanche to disrespect other peoples work by not documenting changes that you make to it, while it remains in their name.

Really, though, my first post was intended to decide whether to treat it as a software or hardware problem...

Hello aarg

aarg:
Open source is not carte blanche to disrespect other peoples work by not documenting changes that you make to it, while it remains in their name.

It's beerware

Regards,
bidouilleelec

Hi aarg, If i ever see him ill buy him a beer.

All the code supplied by spark fun is the same only thing i am trying to do is add a start stop button into it. Its not hardware Because it works great with a latching switch i just cant get it to stop with a momentary switch.
Apologies aarg if i crossed some sort of line. (next time ill make sure i write the code instead of my code) Besides he is the founder of spark fun so i am sure he wouldn't mind me buying his product and using his code.

So at the first press of the button, the clock starts, according to the programming.

However, pressing it again will simply start it again as per the code.

The program executes the function all the time the button is held Low (not pressed I presume).
Once pressed, the while is False and will not be executed. Once released, the while is True again and simply continues the program.

As Noweare pointed out, either include an If statement that leaves the while loop or rewrite the while loop to include another button press or add another function using If statements or states.

Hi holdingpattern

Sorted :slight_smile: Works like a charm... Thank you so much for your help my 9yr old is going to love her new giant stop watch for school :slight_smile:

Many thanks
Nick