Arduino Accelstepper direction control.

Status
Not open for further replies.

dr pepper

Well-Known Member
Most Helpful Member
I've been using 3 steppers with the accelstepper and an arduino.

The issue I have right now is that accelstepper decides which direction to run the motor depending on the position command, ie if current position is 5 and the next commanded position is 4 accelstepper will go back one.
What I need is for the code to only run the stepper in one direction regardless of what position is required.
 
I sussed it in the end.
Because accelstepper uses a long integer for the position I can get a lot of rotations before rolling over, so I just add the next value to the last plus 1 complete revolutionsworth of steps, the result is that the motor positions itself correctly and allways goes one way.
I might be able to reset the position integer in other infrequently run parts of the code.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…