const int Dir = 26;
const int Step = 27;
const int steps_per_rev = 2000;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(Dir, OUTPUT);
pinMode(Step, OUTPUT);
}
void loop() {
digitalWrite(Dir, HIGH); // Clockwise
for (int i = 0; i < steps_per_rev; i++) {
digitalWrite(Step, HIGH);
delayMicroseconds(1000);
digitalWrite(Step, LOW);
delayMicroseconds(1000);
}
delay(2000);
digitalWrite(Dir, LOW); // Counter Clockwise
for (int i = 0; i < steps_per_rev; i++) {
digitalWrite(Step, HIGH);
delayMicroseconds(1000);
digitalWrite(Step, LOW);
delayMicroseconds(1000);
}
delay(2000);
}