Shop OBEX P1 Docs P2 Docs Learn Events
controlling two stepper motors? — Parallax Forums

controlling two stepper motors?

ouconvertouconvert Posts: 17
edited 2006-02-06 15:49 in BASIC Stamp
ive got my uln2803, and my two stepper motors. I see how to run one stepper. but how do i run the other one? in the example code it shows a
DIRB = %1111
·which sets the P4, P5, P6, and P7 to outputs. so with two steppers would i add four more 1's?
DIRB = %11111111
· and in the code how do i drive them seperatly. how does the stamp know which motor to turn at one time and the other at another time?

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-02-04 01:30
    You would select another 4-pin group (e.g., OUTA) to control the other motor -- it's really a matter of duplicating the demo code for the connections established for your second motor.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-02-06 15:49
    You can't add four more ones to DIRB, but you can use DIRL to address the A and B ports at the same time.

    DIRL = %11111111

    Would be the same as:

    DIRA = %1111
    DIRB = %1111

    But in one line instead.· But now you can either use OUTL to control both motors at the same time, or use OUTA and OUTB for individual control.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
Sign In or Register to comment.