// Example Sketch to control a stepper motor with A9488
//Stepper motor driver
// AccelStepper Library and Arduino: Continuos Rotation
#include <AccelStepper.h>
#define dirPin 2
#define stepPin 3
#define microStep 7
#define motorInterfaceType 1 //1 WHEN USING A STEP AND DIRECTION DRIVER
//Create a new instance of the AccelStepper class:
AccelStepper stepper = AccelStepper(motorInterfaceType, stepPin, dirPin);
void setup() {
// put your setup code here, to run once:
//Set the maximum speed in steps per second:
stepper.setMaxSpeed(1000);
Serial.begin(115200);
}
void loop() {
// put your main code here, to run repeatedly:
//Set the speed in steps per second:
stepper.setSpeed(400);
//Step the motor with a constant speed as set by setSpeed();
stepper.runSpeed();
}