Stepper Motor Coding

Dear All,
I am building a project which is using stepper motor. I have a question regarding the way to write the programming code using the stepper motor library in arduino.

  1. I found from tutorial: https://www.arduino.cc/en/Tutorial/MotorKnob
    Stepper stepper(STEPS, 8, 9, 10, 11);

  2. Library reference: Stepper - Arduino Reference
    Stepper myStepper = Stepper(100, 5, 6);

I notice that there are 2 ways to write the code. Can anyone tell me which one is correct? or both way will work?

Thanks.

Both are correct, depending on what is between the Arduino and the stepper. There WILL be something, as the Arduino can NOT power a stepper.

With a stepper driver, with direction and step pins, the second method is used.

With a motor driver that has 4 lines for driving a stepper, the first method is used.

PaulS:
Both are correct, depending on what is between the Arduino and the stepper. There WILL be something, as the Arduino can NOT power a stepper.

With a stepper driver, with direction and step pins, the second method is used.

With a motor driver that has 4 lines for driving a stepper, the first method is used.

Dear Paul,
Thanks for your reply. I am using uln2003 as the thing between uno and stepper motor.
Sorry for this silly question: Is uln2003 a stepper driver or motor driver?

Thanks.

When the ULN2003 is driving a 28BYJ stepper motor you should use the first style Stepper stepper(STEPS, 8, 9, 10, 11); because the ULN2003 does not include the intelligence of specialized stepper drivers (such as the Pololu DRV8825) for bipolar stepper motors.

...R
Stepper Motor Basics

Robin2:
When the ULN2003 is driving a 28BYJ stepper motor you should use the first style Stepper stepper(STEPS, 8, 9, 10, 11); because the ULN2003 does not include the intelligence of specialized stepper drivers (such as the Pololu DRV8825) for bipolar stepper motors.

...R
Stepper Motor Basics

Dear Paul,
Thanks.

sdas86:
Dear Paul,
Thanks.

Oops :slight_smile:

...R

Robin2:
Oops :slight_smile:

...R

Dear Robin,
My apology. Thanks. :slight_smile: