hi, i connected a nema 17 motor to drv8825 by this diagram:
http://www.microsolution.com.pk/wp-content/uploads/2017/09/download.jpg
and wrote this code:
#include <Stepper.h>
const int stepsPerRevolution = 1600;
const int directionPin=3;
const int stepPin=5;
Stepper myStepper(stepsPerRevolution,stepPin,directionPin);
int dir=0;
void setup() {
myStepper.setSpeed(60);
}
void loop()
{
if(dir==0)
{
myStepper.step(stepsPerRevolution);
}
if(dir==1)
{
myStepper.step(-stepsPerRevolution);
}
}
when dir=0 - everything is ok, but if dir=1 - the motor hold its place.
i searched the web for solutions, and tried everything i’ve found, nothing worked.
i hope that there is someone here that could help me.