Hello!
I was recently using my Arduino Uno with the Arduino Motor Shield to drive a NEMA 14 12V Stepper Motor ClockWise, CounterClockWise, then Clockwise again. Everything seemed to be working fine, but I decided to slow down the step speed from 60 to 30. After changing this, however, the motor would not move anymore. I changed the step speed back to 60 and re-uploaded the entire original program, but still the motor would not move. I'm fairly certain it is not an issue with the motor because I can no longer drive any other motors I was able before either. However, I AM able to drive the motor with this code:
int delaylegnth = 5;
void setup() {
//establish motor direction toggle pins
pinMode(12, OUTPUT); //CH A -- HIGH = forwards and LOW = backwards???
pinMode(13, OUTPUT); //CH B -- HIGH = forwards and LOW = backwards???
//establish motor brake pins
pinMode(9, OUTPUT); //brake (disable) CH A
pinMode(8, OUTPUT); //brake (disable) CH B
}
void loop(){
digitalWrite(9, LOW); //ENABLE CH A
digitalWrite(8, HIGH); //DISABLE CH B
digitalWrite(12, HIGH); //Sets direction of CH A
analogWrite(3, 255); //Moves CH A
delay(delaylegnth);
digitalWrite(9, HIGH); //DISABLE CH A
digitalWrite(8, LOW); //ENABLE CH B
digitalWrite(13, LOW); //Sets direction of CH B
analogWrite(11, 255); //Moves CH B
delay(delaylegnth);
digitalWrite(9, LOW); //ENABLE CH A
digitalWrite(8, HIGH); //DISABLE CH B
digitalWrite(12, LOW); //Sets direction of CH A
analogWrite(3, 255); //Moves CH A
delay(delaylegnth);
digitalWrite(9, HIGH); //DISABLE CH A
digitalWrite(8, LOW); //ENABLE CH B
digitalWrite(13, HIGH); //Sets direction of CH B
analogWrite(11, 255); //Moves CH B
delay(delaylegnth);
}
But my original code using the Stepper Library has stopped driving my motors:
#include <Stepper.h>
// change this to the number of steps on your motor
#define STEPS 200
// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it's
// attached to
Stepper stepper(200, 12, 13);
void setup()
{
// set the speed of the motor
stepper.setSpeed(60);
stepper.step(256);
delay(500);
stepper.step(-232);
delay(500);
stepper.step(8);
}
void loop()
{
}
I've used another Arduino Uno board, and the same issue occurs, and i'm still very much unsure of what the problem could be. I'd very much like to use the Stepper Library in my project rather than powering pins manually. Can anyone help? Thank you very much!