vitormhenrique
Well-known member
Hello Guys,
I don't have any previous experience with stepper motors, just trying one little project and testing the AccelStepper library but i'm having a problem.
I'm trying to use positional based control on my stepper motor, but i'm not clear what the "relative position" actually mean, is it angle or something else?
I'm trying the following code, and expected the stepper motor to turn 180 degrees, stop, turn more 180 degrees and so on, but that is not what it is happening.
This is just a test code to understand the library.
The stepper motor is turning a little bit less than 180 every turn.
I don't have any previous experience with stepper motors, just trying one little project and testing the AccelStepper library but i'm having a problem.
I'm trying to use positional based control on my stepper motor, but i'm not clear what the "relative position" actually mean, is it angle or something else?
I'm trying the following code, and expected the stepper motor to turn 180 degrees, stop, turn more 180 degrees and so on, but that is not what it is happening.
This is just a test code to understand the library.
The stepper motor is turning a little bit less than 180 every turn.
Code:
#include <AccelStepper.h>
// Define a stepper and the pins it will use
AccelStepper stepper(1,3,2);
void setup()
{
stepper.setMaxSpeed(600);
stepper.setAcceleration(300);
}
void loop()
stepper.moveTo(stepper.currentPosition()+180);
stepper.runToPosition();
}