// Stepper motor on Wokwi!
#include <Stepper.h>
const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution
// for your motor
// initialize the stepper library on pins 8 through 11:
Stepper myStepper1(stepsPerRevolution, 10, 11, 12, 13);
Stepper myStepper2(stepsPerRevolution, 6, 7, 8, 9);
Stepper myStepper3(stepsPerRevolution, 2, 3, 4, 5);
void setup() {
// set the speed at 60 rpm:
myStepper1.setSpeed(60);
myStepper2.setSpeed(60);
myStepper3.setSpeed(60);
// initialize the serial port:
Serial.begin(9600);
}
void loop() {
// step one revolution in one direction:
Serial.println("clockwise");
myStepper1.step(stepsPerRevolution);
myStepper2.step(stepsPerRevolution);
myStepper3.step(stepsPerRevolution);
delay(2000);
// step one revolution in the other direction:
// Serial.println("counterclockwise");
//myStepper.step(-stepsPerRevolution);
//delay(500);
}