Hi Kerimil,
I have a question for you. Do you have any trouble running this motor in reverse using your modified Accelstepper library? I can only get mine to move forward, then it stalls out when it should run in reverse until it's time to move forward again. I noticed that your code is only calling the motor to move in positive (greater than 0) positions, so it moves in reverse because it (for instance) is moving from 7000 to 2000. I'm using the following basic code, and it won't work in reverse for me:
#include <AccelStepper.h>
AccelStepper stepper3(5, 10, 11,12, 13); //this is the ship rotation motor that is controlled by encoder, the '5' signifies that the motor is a 28byj-48 8-step motor. This uses the modified accelstepper library
void setup()
{
stepper3.setMaxSpeed(150.0);
stepper3.setAcceleration(300.0);
stepper3.moveTo(768);
}
void loop()
{
// Change direction at the limits
if (stepper3.distanceToGo () == 0)
stepper3.moveTo(-stepper3.currentPosition());
stepper3.run();
}
Any thoughts on why this doesn't work? It works with other motors and the original Accelstepper library.
Thanks in advance!
Atman