const int DIR=12;
const int STEP=14;
const int steps_per_rev=50;
void setup()
{
Serial.begin(115200);
pinMode(STEP, OUTPUT);
pinMode(DIR, OUTPUT);
}
void loop()
{
digitalWrite(DIR,HIGH);
Serial.println("Girando no sentido horario");
for(int i=0;i<steps_per_rev;i++)
{
digitalWrite(STEP, HIGH);
delayMicroseconds(2000);
digitalWrite(STEP,LOW);
delayMicroseconds(2000);
}
delay(1000);
digitalWrite(DIR, LOW);
Serial.println("Girando en sentido anti-horario");
for(int i=0;i<steps_per_rev;i++)
{
digitalWrite(STEP, HIGH);
delayMicroseconds(2000);
digitalWrite(STEP,LOW);
delayMicroseconds(2000);
}
delay(1000);
}