Help on programming PSC
fleurdelis158
Posts: 5
Greetings.
I'm new to this programming stuff of Basic Stamp. I need some help in programming two servos to make my robot move forward (or backward). I'm using BS2p24 microcontroller and Board of Education Rev C. I also use the Parallax Servo Controller (#28023). I've tried to program it but all i can do is making the servo rotating in the same direction. I know that in order to make the robot move forward (or backward), one servo must rotate clockwise and the other must rotate counterclockwise, but i really don't know how. What position should i put in my program?(GWS servos are used). Which command should I use?
I'm new to this programming stuff of Basic Stamp. I need some help in programming two servos to make my robot move forward (or backward). I'm using BS2p24 microcontroller and Board of Education Rev C. I also use the Parallax Servo Controller (#28023). I've tried to program it but all i can do is making the servo rotating in the same direction. I know that in order to make the robot move forward (or backward), one servo must rotate clockwise and the other must rotate counterclockwise, but i really don't know how. What position should i put in my program?(GWS servos are used). Which command should I use?
Comments
For a BS2, "PULSOUT ServoPin1, 750" will generate a 1.5 mSec pulse (since that's 750 * 2 uSec). Some people use
"PULSOUT ServoPin1, 500", and "Pulsout ServoPin2, 1000" to get a 1 mSec (spin one way) and 2 mSec (spin the other way) pulse. Then you need a "Pause 20" before doing it again.
' {$STAMP BS2p}
' {$PBASIC 2.5}
ch VAR Byte
ch2 VAR Byte
pw VAR Word
pw2 VAR Word
ra VAR Byte
Sdat CON 15
baud CON 396
i VAR Byte
ra = 7
ch = 14
ch2= 15
FOR i=1 TO 10
pw = 1240
pw2= 1240
SEROUT Sdat, 1021,[noparse][[/noparse]"!SC", ch, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
SEROUT Sdat, 1021,[noparse][[/noparse]"!SC", ch2, ra, pw2.LOWBYTE, pw2.HIGHBYTE, CR]
PAUSE 500
pw = 260
pw2= 260
SEROUT Sdat, 1021,[noparse][[/noparse]"!SC", ch, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
SEROUT Sdat, 1021,[noparse][[/noparse]"!SC", ch2, ra, pw2.LOWBYTE, pw2.HIGHBYTE, CR]
PAUSE 500
NEXT
END
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Anyway, I've tried lowering the pulses of one of the servo to 500.but its still not working.does it has anything to do with the potentiometer inside the servo?
If you change it like this, the servos should go seperate ways
Don't know if the FOR loop is working though?
Pengatom
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
1 + 1 = 10· |· 4 + 4 = 10· |· 5 + 5 = 10· |· 8 + 8 = 10
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com