Using AccelStepper library w/stepper driver + Step, Direction, and Enable Pins

I’ve been searching the forums and the web on how to properly use the step, direction, and enable inputs of my stepper driver and to program them accordingly for use with the AccelStepper library.

I’ve been using these resources:
https://www.airspayce.com/mikem/arduino/AccelStepper/classAccelStepper.html

https://groups.google.com/forum/#!topic/accelstepper/548T1E4tbfo

Any point in setup() before you call .enableOutputs();

FYI I am running the driver at 6400 pulses/rev (32 microsteps)
TB6600 4A 9-42V Stepper Motor

Using the code below my stepper does not move at all.

Also I was wondering for:
stepper.enableOutputs();
Does .enableOutput need a pin assigned to it or is the goal of this just to enable/disable the stepper motor?

//accelstepper constant speed example has been altered and is being used
// not using default 4 wires setup, but instead using step, direction, and enable pins
// using TB6600 4A 9-42V stepper driver at 6400 pulses/rev (32 microsteps)

#include <AccelStepper.h>

// defines pins numbers
const int stepPin = 3;
const int directionPin = 4;
const int enablePin = 5;

// Define a stepper and the pins it will use
// 1 or AccelStepper::DRIVER means a stepper driver (with Step and Direction pins)
AccelStepper stepper(AccelStepper::DRIVER, stepPin, directionPin);

void setup()
{
  Serial.begin(9600);

  stepper.setEnablePin(enablePin);
  stepper.enableOutputs();
  stepper.setMaxSpeed(1000);
  stepper.setSpeed(50);
}

void loop()
{
  stepper.runSpeed();
}

The function setEnablePin() defines the pin number

You could also manage the enable pin yourself with digitalWrite(enablePinNumber, HIGH);

...R

why don't you start with one of the AccelStepper examples

In my code below I'm actually using the Accelstepper example:
https://www.airspayce.com/mikem/arduino/AccelStepper/ConstantSpeed_8pde-example.html

I am also using setEnablePin()
in the example below and I'm positive it's pin 5 on the Arduino.

I also used enableOutputs() in the setup code.
However, nothing moves at all.

knightridar:
I also used enableOutputs() in the setup code.
However, nothing moves at all.

Do you have any program that makes the motor move? If so please post that.

I never know whether the enable pin should be HIGH or LOW to make the motor move. You need to try both options.

This Simple Stepper Code can be used for testing - it does not use any library. If you don't have a program that gets the motor moving start with the first of my examples and stick with that until the motor moves properly. Always start with a very slow step rate.

...R

I remembered I had a similar issue with an encoder stepper driver.
It had to do with the wiring and calling a LOW or HIGH based on how the stepper was wired.
Someone suggested it on the forum and that fixed it.

https://groups.google.com/forum/#!topic/accelstepper/6KNJ1801Vl4
I did the same thing this time with my code and it started to move,

 stepper.setPinsInverted(false, false, true);

Full code for reference:

//accelstepper constant speed example has been altered and is being used
// not using default 4 wires setup, but instead using step, direction, and enable pins
// using TB6600 4A 9-42V stepper driver at 6400 pulses/rev (32 microsteps)

#include <AccelStepper.h>

// defines pins numbers
const int stepPin = 3;
const int directionPin = 4;
const int enablePin = 5;

// Define a stepper and the pins it will use
// 1 or AccelStepper::DRIVER means a stepper driver (with Step and Direction pins)
AccelStepper stepper(AccelStepper::DRIVER, stepPin, directionPin);

void setup()
{
  Serial.begin(9600);

  stepper.setEnablePin(enablePin);
  stepper.setPinsInverted(false, false, true);
  stepper.enableOutputs();
  stepper.setMaxSpeed(1000);
  stepper.setSpeed(200);
}

void loop()
{
  stepper.runSpeed();
}