Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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.

New Articles From Microcontroller Tips

Back
Top