Call run(), the motor rotates in the wrong direction in the first step, then in the right direction in the following steps.
What should it be
Call run(), the motor rotates in the right direction for all steps.
Example
In the example RunningSequence, the steps should be 10 positive steps, 10 negative steps and 100 negative steps. However, the first 20 steps are 1-neg-10-pos-9-neg, or 1-neg-9-pos-1-pos-9-neg. The last 100 steps run correctly by rotate(180) with speed -2.
Possible cause
Timing with delay() has some error at the starting and ending. It might be the cause because timing using TimerManager in rotate() runs correctly.
Behavior of AccelStepper, or motor's physical limit.
Possible solution
Time with TimerManager, rather than delay().
Run examples of AccelStepper, or use another motor.
By running AccelStepper's example, ConstantSpeed, motor runs in the way I observed. The first step runs in wrong direction. So it is AccelStepper's behavior.
Thought
Why rotate() runs correctly while run() does wrong?
Description
What's wrong
Call run(), the motor rotates in the wrong direction in the first step, then in the right direction in the following steps.
What should it be
Call run(), the motor rotates in the right direction for all steps.
Example
In the example RunningSequence, the steps should be 10 positive steps, 10 negative steps and 100 negative steps. However, the first 20 steps are 1-neg-10-pos-9-neg, or 1-neg-9-pos-1-pos-9-neg. The last 100 steps run correctly by rotate(180) with speed -2.
Possible cause
Possible solution