arduinoStepper
This Arduino sketch drives multiple stepper motors via serial commands using the Adafruit Motor/Stepper/Servo Shield v2.
- Supports up to 12 steppers
- Allows simultaneous, asynchronous movement of all steppers
- Speed and acceleration/deceleration
- Uses the AccelStepper library
Receive serial command to move a stepper motor
Note: Serial commands sent to the Arduino must be terminated by a linefeed - \n
Serial input to Arduino
stepperID steps speed acceleration
Example:
1 200 300 100
- Moves the second stepper
- To the position at 200 steps (usualy one rotation of the motor)
- Using a speed of 300
- With acceleration and deceleration of 100 (higher is faster)
Receive serial command to stop a stepper motor
Serial input to Arduino
stepperID unused speed acceleration
Example:
1 0 0 0
- Stops the second stepper
- The second parameter is unused, but must be present
- Speed must be set to zero
- Stops as soon as it can, using the acceleration specified
Send serial to indicate stepper start/stop
Serial output from Arduino
stepperID state
Example:
1 1
Indicates that stepper ID 1 started a move
Example:
1 0
Indicates that stepper ID 1 reached its destination and stopped