servo problem
bluejay
Posts: 131
in BASIC Stamp
When the GOSUB nine is executed and program ends the pointer on the servo moves a couple degrees clockwise. Why does the servo move just
before end statement? Could somebody please explain? I would like the pointer not to move when program ends. I also couldn't figure out how to post a video of the servo. Thanks in advance.
before end statement? Could somebody please explain? I would like the pointer not to move when program ends. I also couldn't figure out how to post a video of the servo. Thanks in advance.
' {$STAMP BS2} ' {$PBASIC 2.5} 'servoclock1 counter VAR Word GOSUB three GOSUB two GOSUB noon GOSUB ten GOSUB nine END two: FOR counter = 1 TO 100 '2pm position PULSOUT 14, 500 PAUSE 20 NEXT RETURN noon: FOR counter = 1 TO 100 'noon position PULSOUT 14, 700 PAUSE 20 NEXT RETURN nine: FOR counter = 1 TO 100 '9pm position PULSOUT 14, 1250 PAUSE 20 NEXT RETURN ten: FOR counter = 1 TO 100 '10pm position PULSOUT 14, 900 PAUSE 20 NEXT RETURN three: FOR counter = 1 TO 100 'threepm position PULSOUT 14, 250 PAUSE 20 NEXT RETURN
Comments
DO : LOOP
after the GOSUB nine and before the END
The catch, though, is that every 2.3 seconds, the output switches to an input for 18 ms, which could cause the servo to twitch. So, in fact, your cure should work as prescribed.
-Phil
I solved the problem by replacing " PULSOUT 14, 1250" with "PULSOUT 14, 1100."
Thanks for the effort anyway.