1

I am trying to use the stepper library and the stepper object is documented like this

This function creates a new instance of the Stepper class that represents a particular stepper motor attached to your Arduino board.
Use it at the top of your sketch, above setup() and loop(). The number of parameters depends on how you’ve wired your motor, either using two or four pins of the Arduino board.
Syntax
Stepper(steps, pin1, pin2)
Stepper(steps, pin1, pin2, pin3, pin4)
Parameters
steps: the number of steps in one revolution of your motor. If your motor gives the number of degrees per step, divide that number into 360 to get the number of steps (e.g. 360 / 3.6 gives 100 steps).
pin1, pin2: two pins that are attached to the motor.
pin3, pin4: the last two pins attached to the motor, if it’s connected to four pins.
Returns A new instance of the Stepper motor class. Example Stepper myStepper = Stepper(100, 5, 6); """

The problem is that "two pins" and "last two pins" do not tell me anything about which pins go where on the motor driver. I am using a DM320T stepper driver

Can anybody tell me what "pin1 pin2 pin3 pin4" actually correspond to?

enter image description here

1 Answer 1

1

The standard Stepper library does not support stepper drivers, which only have a step (in this case labels "PUL" for pulse) and a direction pin (labeled "DIR"). So you need to use a different library. I suggest using the Accelstepper library, which is also more capable than the standard Stepper library. Then you can define the AccelStepper object like this:

AccelStepper stepper(AccelStepper::DRIVER, STEPPER_DIR_PIN, STEPPER_STEP_PIN);

About the connections: The shown driver is meant to be connected with twisted wire pairs, so in this case one wire for signal and the other for ground or 5V. Look at the documentation for your stepper driver. There you should be able to find a wiring diagram.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.