I am driving a Nema 17, with the motor shield v2 from adafruit with the following sketch:
Code: Select all
#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_MS_PWMServoDriver.h"
Adafruit_MotorShield AFMS = Adafruit_MotorShield();
Adafruit_StepperMotor *myMotor = AFMS.getStepper(1, 2);
void setup() {
AFMS.begin();
myMotor->setSpeed(1);
}
void loop() {
myMotor->step(1, FORWARD, MICROSTEP);
}
Sometimes, when I plug the power supply, the stepper doesnt start turning, and sometimes, after some time of working correctly, it stops turning.
Any idea?
Where to start troubleshooting?
thanks.-