Stepper motor code help needed.
NWCCTV
Posts: 3,629
I modified the Unipolar Stepper program from the OBEX so that the stepper motor turns clockwise when a button is pressed. I am using the motor and driver from this thread: http://forums.parallax.com/showthread.php/141149-3-Stepper-Motor-amp-Board?highlight=dollar+stepper Everything works as expected but I need to know how to end the program. The motor stops upon releasing the button on P4 but 2 of the lights on the ULN2003 driver board stay on. I tried QUIT but that kills the whole program. Just a little help at the end is all I need.
Here's the code. Thanks in advance for the help.
Here's the code. Thanks in advance for the help.
PUB main dira[3..0]~~ 'make pins outputs FullStep 'High torque PUB FullStep 'High torque repeat ' Main loop if ina[4] == 1 ' If P3 pushbutton pressed stpDelay := 250 'initial speed repeat 1 'Distance stpDelay := 250 stepFwd waitcnt(clkfreq/stpDelay + cnt) 'speed 250 steps per second PRI stepFwd stpIdx := ++stpIdx // 4 ' point to next step outa[3..0] := Steps[stpIdx] ' update outputs
Comments