CODE FOR STEPPER MOTOR HELP

Hello Everybody,

I need your help to create a special command.
In effect, i know how to control my stepper motor for one revolution clockwise and unclockwise.
But i don't know how to control it just with a push button and just one position....

Example :
I push the button
The stepper goes to the 1 of the clock
i push another time and the stepper will go to the 2 of the clock
Same action for 8 times
That's same speed and same distance between each stop.

I don't know if i need to do just one line or many lines of codes???????
Many thanks for your help
Sorry for my English, i'm french :slight_smile:

Aurelien

I don't know if i need to do just one line or many lines of codes?

How is the stepper connected to the Arduino?

How many steps are needed to move the stepper 30 degrees (1/12 of a revolution; the distance between 12 and 1, between 1 and 2, etc.)?

Have you looked at the state change detection example? Instead of incrementing a counter, you want to step some number of times.

The examples in this Simple Stepper Code should give you some ideas.

Be aware that a 200 step motor cannot move exactly 30 deg. You would need to move 17 steps for some moves and 16 steps for some others to ensure you do exactly 200 steps by the time you get back to 0.

...R
Stepper Motor Basics