#include <Stepper.h>
const int stepsPerRevolution = 200;
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);
const int potPin = A0;
int previousStepCount = 0;
void setup() {
myStepper.setSpeed(60);
}
void loop() {
int potValue = analogRead(potPin);
int stepCount = map(potValue, 0, 1023, 0, stepsPerRevolution);
if (stepCount != previousStepCount) {
int stepsToMove = stepCount - previousStepCount;
myStepper.step(stepsToMove);
previousStepCount = stepCount;
}
delay(10);
}