I have a stepper wired up to a MKS GEN board with a DRV8825 driver in place. I have verified the wiring and have no problem running the stepper using the Laurb StepperDriver library. I can’t seem to get the Accel Stepper library to do anything for me. The stepper doesn’t respond at all (no motion, no whining, etc). I’m not sure what code to post as I’ve tried a variety of settings, but below is my best attempt at what I think is the bare minimum to make this work. I’m not exactly certain how the enable stepper functions work with accelstepper since I have not been able to find sample code that utilizes it. Any thoughts/comments would be appreciated.
AccelStepper code
#include <AccelStepper.h>
AccelStepper stepper(AccelStepper::DRIVER, 54, 55);
void setup()
{
stepper.setMaxSpeed(150);
stepper.setSpeed(50);
stepper.setAcceleration(100);
stepper.setEnablePin(38);
stepper.enableOutputs();
}
void loop()
{
stepper.runSpeed();
}
===============================
Laurb StepperDriver Code (works!)
#include <Arduino.h>
#include "BasicStepperDriver.h"
// Motor steps per revolution. Most steppers are 200 steps or 1.8 degrees/step
#define MOTOR_STEPS 200
#define RPM 200
// Since microstepping is set externally, make sure this matches the selected mode
// If it doesn't, the motor will move at a different RPM than chosen
// 1=full step, 2=half step etc.
#define MICROSTEPS 1
// All the wires needed for full functionality
#define DIR 55
#define STEP 54
//Uncomment line to use enable/disable functionality
#define ENABLE 38
// 2-wire basic config, microstepping is hardwired on the driver
//BasicStepperDriver stepper(MOTOR_STEPS, DIR, STEP);
//Uncomment line to use enable/disable functionality
BasicStepperDriver stepper(MOTOR_STEPS, DIR, STEP, ENABLE);
void setup() {
stepper.begin(RPM, MICROSTEPS);
}
void loop() {
// energize coils - the motor will hold position
stepper.enable();
/*
* Moving motor one full revolution using the degree notation
*/
stepper.rotate(1200);
delay(1000);
/*
* Moving motor to original position using steps
*/
stepper.move(-1200);
// pause and allow the motor to be moved by hand
stepper.disable();
delay(1000);
}