So I'm having an issue with reversing the direction using just runSpeed. I've looked through examples and questions, and it sounds like you can set speed to be a negative value for it to go CCW. However, when I tried that out, my motor still moves in the clockwise direction. I'm using a stepper motor from sparkfun with the bigeasydriver. Here's my code:
#include <AccelStepper.h>
const int stepsPerRevolution = 400;
const int microstep = 16;
int rpm = 2*60;
float sensorSpeed = 12800;
int motorDirPin = 10; //digital pin 2
int motorStepPin = 11; //digital pin 3
//set up the accelStepper intance
//the "1" tells it we are using a driver
AccelStepper sensor_motor(1, motorStepPin, motorDirPin);
void setup()
{
Serial.begin(115200);
sensor_motor.setCurrentPosition(0);
sensor_motor.setMaxSpeed(sensorSpeed);
sensor_motor.setSpeed(-1*sensorSpeed);
}
void loop()
{
sensor_motor.runSpeed();
}