I'm using a 4 wire bipolar stepper with easy driver using step/dir/MS1/MS2 as pins 2,3,4,5 respectively.
Using the easy driver code I can successfully perform half step rotations.
When using the AccelStepper library and code that causes the motor to go in forward and then in reverse for a few seconds using FULL4WIRE and HALF4WIRE causes the motor to not reverse when expected and continues to spin in one direction
AccelStepper stepper(AccelStepper::FULL4WIRE, 2, 3,4,5)
AccelStepper stepper(AccelStepper::HALF4WIRE, 2, 3,4,5)
Using DRIVER or FULL2WIRE works as expected in terms of forward/reverse of the stepper although FULL2WIRE behaves like a half-step.
AccelStepper stepper(AccelStepper::FULL2WIRE, 2, 3)
AccelStepper stepper(AccelStepper::DRIVER, 2, 3)
stepper: https://www.sparkfun.com/datasheets/Robotics/SM-42BYG011-25.pdf
driver: Easy Driver Hook-up Guide - SparkFun Learn
The current documentation is unclear...
Does using DRIVER/FULL2DRIVER mean we can only using step/dir pins and not MS1/MS2 for half steps? is this a limitation of using the easydriver with AccelStepper library?
What is the difference between DRIVER and FULL2DRIVER?
If I want to use the MS1/MS2 for half steps how I can I use that using AccelStepper library if 4 wire stepper does not work with the FULL4/HALF4?
Does the Caution for blocking delay apply to all enumerators types or just DRIVER?
Number of pins to interface to. Integer values are supported, but it is preferred to use the MotorInterfaceType symbolic names. AccelStepper::DRIVER (1) means a stepper driver (with Step and Direction pins). If an enable line is also needed, call setEnablePin() after construction. You may also invert the pins using setPinsInverted(). Caution: DRIVER implements a blocking delay of minPulseWidth microseconds (default 1us) for each step. You can change this with setMinPulseWidth(). AccelStepper::FULL2WIRE (2) means a 2 wire stepper (2 pins required). AccelStepper::FULL3WIRE (3) means a 3 wire stepper, such as HDD spindle (3 pins required). AccelStepper::FULL4WIRE (4) means a 4 wire stepper (4 pins required). AccelStepper::HALF3WIRE (6) means a 3 wire half stepper, such as HDD spindle (3 pins required) AccelStepper::HALF4WIRE (8) means a 4 wire half stepper (4 pins required) Defaults to AccelStepper::FULL4WIRE (4) pins.
#include <AccelStepper.h>
// Define a stepper and the pins it will use
AccelStepper stepper(AccelStepper::DRIVER, 2, 3);
int pos = 3600;
void setup()
{
stepper.setMaxSpeed(3000);
stepper.setAcceleration(1000);
}
void loop()
{
if (stepper.distanceToGo() == 0)
{
delay(500);
pos = -pos;
stepper.moveTo(pos);\
}
stepper.run();
}