My stepper motor is not turning counterclockwise. When it tries to turn it just goes on in one direction.
Here is my code:
#include <Stepper.h>
int stepsPerRevolution=2048;
int stepsPerRevolution2=-2048;
int motSpeed=10;
int dt=500;
Stepper myStepper (stepsPerRevolution, 8,9,10,11);
void setup() {
// put your setup code here, to run once:
Serial.begin (9600);
myStepper.setSpeed (motSpeed);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.println ("clockwise");
myStepper.step (stepsPerRevolution);
delay (dt);
Serial.println ("counterclockwise");
myStepper.step (stepsPerRevolution2/2);
delay (dt);
}
Sorry, I was thinking of a different stepper library. That should have worked, so check the motor wiring for continuity. Perhaps one coil is not properly connected, or the wire order is not correct. On those motors, the wire colors vary between manufacturers.