#include <Stepper.h>
// Number of steps per internal motor revolution
const int stepsPerRevolution = 2048;
// Initialize the library on pins 8 through 11
// Note: For ULN2003, the sequence is usually 8, 10, 9, 11
Stepper myStepper(stepsPerRevolution, 8, 10, 9, 11);
void setup() {
myStepper.setSpeed(10); // Set speed to 10 RPM
Serial.begin(9600);
}
void loop() {
// Step one full revolution in one direction:
Serial.println(“Clockwise”);
myStepper.step(stepsPerRevolution);
delay(1000);
// Step one full revolution in the other direction:
Serial.println(“Counterclockwise”);
myStepper.step(-stepsPerRevolution);
delay(1000);
}