#include <Stepper.h> // include stepper library
int revolution = 2038; // the number of steps in one revolution of your motor (28BYJ-48)
Stepper stepper(revolution, 8, 10, 9, 11); // the correct stepping order for your motor (28BYJ-48)

void setup() { // set driver pins as OUTPUT
pinMode(8, OUTPUT);
pinMode(10, OUTPUT);
pinMode(9, OUTPUT);
pinMode(11, OUTPUT);

// Begin Serial communication at a baud rate of 9600:
Serial.begin(9600);
}

void loop() {
Serial.println(“pp kiirusega 10 rpm”);
stepper.setSpeed(10); // 18 = max working speed for this motor. 10 is max recommended speed
stepper.step(revolution); // move motor one revolution anti-clockwise (2038 steps)
halt(); // call ‘halt()’ function to write motor pins LOW
Serial.println(“ootab 3 sekundit”);
delay(3000); // wait one second (optional)

Serial.println(“vp kiirusega 5 rpm”);
stepper.setSpeed(5); // set speed to 5
stepper.step(-revolution); // move motor one revolution clockwise (-2038 steps)
halt();
Serial.println(“ootab 5 sekundit”);
delay(5000);

}

void halt() { // This writes all motor pins LOW, preventing the motor from drawing current when idle.
digitalWrite(8, LOW);
digitalWrite(9, LOW);
digitalWrite(10, LOW);
digitalWrite(11, LOW);
}