View Full Version : Controlling 2 Servo's Simultaneously

05-18-2005, 12:25 PM
Does anyone know if you can run 2 sero's simultaneously with Basic Stamp 2? I've thought of using a background process or something, is this possible with Basic Stamp? I'm also trying to avoid using the "Parallax Servo Controller" . Right now I find that when I leave one·servo unpowered and go on (in the program) to the next servo, the unpowered servo losses its position(due to the·weight of the actuating arm). So is there any way to keep it powered whilst I move the other one?··Any help would be appreciated!!

Jon Williams
05-18-2005, 08:10 PM
You need to refresh the servo every 20 ms or so, otherwise you'll see this problem. If you're not able to do that because of your other processing then you may need a controller. That said, we frequently use two servos and do other things -- have a look at any of our BOE-Bot projects.

Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA

05-18-2005, 09:34 PM
Yes, you can use two servos
ServoOne CON 0 ' ServoOne's control pin
ServoTwo CON 1 ' ServoTwo's control pin

ServoOnePulse VAR WORD
ServoTwoPulse VAR WORD

· ServoOnePulse = 750 ' On BS2, 750 * 2 uSec is 1.5 mSec, or center position
· ServoTwoPulse = 750
· FOR I = 1 to 250
··· ServoOnePulse = ServoOnePulse + 1
··· ServoTwoPulse = ServoTwoPulse + 1
··· GOSUB ServoRefresh
··· PAUSE 20

' *** Subroutines ***

· PULSOUT ServoOne, ServoOnePulse
· PULSOUT ServoTwo, ServoTwoPulse

' The point here is, you can do 'PULSOUT' for several servo's, then have a single delay
' before you refresh them all again.
'· The ServoRefresh routine makes sure they keep their position (if you haven't changed it)
'· or move to a new position (if you have).

Post Edited (allanlane5) : 5/18/2005 2:37:12 PM GMT