#include <AccelStepper.h>
// Define stepper motor connections and other settings
#define DIR_PIN 8
#define STEP_PIN 9
#define STEPS_PER_REV 200
AccelStepper stepper(AccelStepper::DRIVER, STEP_PIN, DIR_PIN);
void setup() {
// Set the maximum speed and acceleration of the stepper motor
stepper.setMaxSpeed(1000);
stepper.setAcceleration(200);
}
void loop() {
// Rotate the stepper motor for 3 seconds
stepper.moveTo(STEPS_PER_REV);
stepper.runToPosition();
delay(3000);
// Stop the stepper motor for 5 seconds
stepper.stop();
stepper.setCurrentPosition(0);
delay(2000);
}