// 22.11.4562 - Muhammad Guido Augusta
const int dirPin = 3;
const int stepPin = 2;
const int stepsPerRevolution = 200;
void setup() {
// put your setup code here, to run once:
pinMode(dirPin, OUTPUT);
pinMode(stepPin, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
for (int i = 0; i < 2; i++) {
digitalWrite(dirPin, HIGH);
for (int x = 0; x < stepsPerRevolution / 4; x++) {
digitalWrite(stepPin, HIGH);
delayMicroseconds(2000);
digitalWrite(stepPin, LOW);
delayMicroseconds(2000);
}
delay(1000);
}
for (int i = 0; i < 2; i++) {
digitalWrite(dirPin, LOW);
for (int x = 0; x < stepsPerRevolution / 2; x++) {
digitalWrite(stepPin, HIGH);
delayMicroseconds(2000);
digitalWrite(stepPin, LOW);
delayMicroseconds(2000);
}
delay(1000);
}
}