#include const int stepsPerRevolution = 200; // Motor parameter // Initialize the stepper library on pins 8 through 11 Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11); void setup() { // Set the speed at 20 rpm to make it slower myStepper.setSpeed(40); } void loop() { // Reduced number of revolutions to half int n = 2.7; // Now the motor will only turn 2.5 revolutions int t1 = 5; // Delay time (in seconds) for the first direction int t2 = 60; // Delay time (in seconds) for the second direction // Step n revolutions in one direction myStepper.step(n * stepsPerRevolution); delay(t1 * 1000); // Wait for t1 seconds // Step n revolutions in the other direction myStepper.step(-n * stepsPerRevolution); delay(t2 * 1000); // Wait for t2 seconds }