#include <AccelStepper.h>
// Define a stepper and the pins it will use
// AccelStepper stepper1; // Defaults to AccelStepper::FULL4WIRE (4 pins) on 2, 3, 4, 5
AccelStepper stepper1(AccelStepper::FULL4WIRE, 4, 5, 6, 7);
// This defines the analog input pin for reading the control voltage
// Tested with a 10k linear pot between 5v and GND
const byte PositionPot = A0;
// const byte AccelerationPot = A1;
void setup()
{
stepper1.setMaxSpeed(1000);
stepper1.setAcceleration(50);
Serial.begin(115200);
}
void loop()
{
// Read new position
int analog_in = analogRead(PositionPot);
//stepper1.setAcceleration(analogRead(AccelerationPot));
stepper1.moveTo(analog_in);
stepper1.run();
}