Controlling 2 Servo's Simultaneously
Mattyh
Posts: 1
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!!
-Matt
-Matt
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA
ServoOne CON 0 ' ServoOne's control pin
ServoTwo CON 1 ' ServoTwo's control pin
ServoOnePulse VAR WORD
ServoTwoPulse VAR WORD
I VAR BYTE
MAIN:
· 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
· NEXT
· GOTO MAIN
' *** Subroutines ***
ServoRefresh:
· PULSOUT ServoOne, ServoOnePulse
· PULSOUT ServoTwo, ServoTwoPulse
· RETURN
' 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