203Views3Replies

Author Options:

Is there a way to count button pushes on an arduino and have the led blink after pressed the button 4 time? Answered

i would like to make if the button pressed 4 time.. led will start blinking for 5 second and if button pressed 8 time.. led will start blinking for 10 second... Can anyone help me with an example code or a tutorial somewhere? Greatly Appreciated!

3 Replies

user
Josehf Murchison (author)2016-02-23

Yes use the Arduino debounce.

This works with Arduino UNO and MEGA.

Select as Best AnswerUndo Best Answer

user
steveastrouk (author)2016-02-23

If button pressed, increment counter

Wait until button isn't pressed.

If counter =4 blink led. then reset counter.

Select as Best AnswerUndo Best Answer

user
bwrussell (author)2016-02-23

Check out the Tutorials and Reference sections of the Arduino website. You should be able to piece it together from there.

You can simply count the number of presses with a variable and when it reaches certain counts you can have it do whatever you need.

I can help with specific questions/issues but you should try and write as much of it yourself as you can.

Select as Best AnswerUndo Best Answer