Shop OBEX P1 Docs P2 Docs Learn Events
is it possible to make servo run so long and keep doing it over and over — Parallax Forums

is it possible to make servo run so long and keep doing it over and over

hmillerhmiller Posts: 17
edited 2011-07-18 18:14 in BASIC Stamp
Hi,
I was wondering if it's possible to have a servo run for a length of time and stop and keep doing the same thing over and over when a button is pushed. What I'm wondering is if i can push a button and the servo runs for a period of time and then i can keep pushing that button and it will keep doing it.
All the examples and other things I posted make it seem as if the servo only has positions. I bought a continuous servo for this reason so i can keep it going in one direction.

Please help...

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-07-18 18:14
    The same examples used for standard servos will work for continuous servos. Instead of the control pulse specifying the desired servo position, it indicates the servo direction and speed. The PULSOUT statements you see in the examples are inside FOR/NEXT loops. Since a servo has to have a control pulse about every 20ms, the number of times in the FOR/NEXT loops determines how long the servo moves (in 20ms increments). Once the pulses stop, the servo will stop (within maybe 30-50ms). Set up a loop for the amount of time you want and execute the loop when the button is pushed. When the loop is done, go back and check the button again. If it's still pushed, the servo will move again for the amount of time you've programmed.
Sign In or Register to comment.