loading

push button basics help?

I'm new to arduino's but not new to programming, more of a novice,
so my question is more physical than logical-

why does my push button say i've pressed it 4 to 7 times on the serial print, when i've only pressed it once? is my push button broken?
and when i hold the push button down, the serial print says i'm pressing it repeatedly? 

Because the Arduino ran through the sketch 4 to 7 times in the time it took for you to press and release the button.

If your familiar with programming you should understand why it's doing this. The Adruino runs through the void loop of the ketch over and over again. Once it reaches the end of the void loop it goes to the beginning. The Arduino is able to run through the small button sketch multiple times in a second. Each time it runs through the loop it detects the button press as a new press. This is why it thinks the button is being press multiple times if you just hold it down. Try looking at the Debounce sketch to learn how to make it only detect the button press once even if you hold it down.
DemolisionWolf (author)  mpilchfamily3 years ago
ahhhh, i see i see. for some reason I was under the impression that when the button is pressed (held or not) that the sketch would recognize it as one incriment.

I greatly appreciate your advise and I'll check that debounce sketch out