i bought today my first stepper motor , specifically the NEMA17 (JK42HS48-1684-08AF) and paired it with the DRV8825 stepper motor driver. I connected them accordingly to some tutorials i found. The motor though doesn't rotate at all! It just vibrates and makes a noise when it is supposed to be enabled. I am supplying the arduino through the usb port and the driver/stepper through a 12v dc and i have tried a 9v battery too. None work. What am I doing wrong???? please help me! thanks
the code I found online:
// Define pin connections & motor's steps per revolution
const int dirPin = 2;
const int stepPin = 5;
const int stepsPerRevolution = 200;
void setup()
{
// Declare pins as Outputs
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);
}
void loop()
{
// Set motor direction clockwise
digitalWrite(dirPin, HIGH);
// Spin motor slowly
for(int x = 0; x < stepsPerRevolution; x++)
{
digitalWrite(stepPin, HIGH);
delayMicroseconds(2000);
digitalWrite(stepPin, LOW);
delayMicroseconds(2000);
}
delay(1000); // Wait a second
// Set motor direction counterclockwise
digitalWrite(dirPin, LOW);
// Spin motor quickly
for(int x = 0; x < stepsPerRevolution; x++)
{
digitalWrite(stepPin, HIGH);
delayMicroseconds(1000);
digitalWrite(stepPin, LOW);
delayMicroseconds(1000);
}
delay(1000); // Wait a second
}