Rotating a servo only every X presses of a button

Hello! I'm pretty brand new to arduino. I've tried every combination of search terms for what I'm trying to do that I can think of and I haven't been able to find anything, so I'm hoping you all might be able to help.

What I'm trying to do is have a servo connected to a push button that makes it rotate 180 degrees, hold there for 30 seconds, and then rotate back to 0 with a single push. However, I only want this action to take place on every 11th press of the button. So 10/11 times that you push the button, nothing happens to the servo. So far, all I've been able to make it do is rotate the servo 180 when I press the button, and then rotate it back to 0 when I press it again. I found some code for initiating the servo to rotate, hold, and rotate back with a button push, but I haven't even been able to get that to work.

Any help/advice/resources you can point me towards is super, super appreciated! Thanks for your time!

You have been searching for the wrong thing.
Search for "Arduino + servo".
Search for "Arduino + button".
Search for "Arduino + timer".
When You master those 3 different parts start to combine the knowledge into the project You have.

1 Like

Awesome, thank you! I will do just that!

Read this change in state example:

Read this BWD example:

Do you understand how to make a counter variable and use it to control an action ?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.