Help with continuous rotation servos
skatj
Posts: 88
Hi, I'm working on a robot and I'm just finished building the chassis so I tested out the drive system with some code. However, whenever I run the program, the servos move very very slowly. When I press the reset button, or re-upload the program while this is happening, the servos start to run as normal. This isn't that big of a deal but could become a problem later on. Any ideas why this is happening?
(I'm using the PSC serial)
In addition, the code above moves the robot foward, for some reason the servos will go in opposite directions with the same pulse widths (their orientation is the same)
(I'm using the PSC serial)
' {$STAMP BS2} ' {$PBASIC 2.5} Sdat CON 12 baud CON 396 ServoPos1 VAR Word ServoPos2 VAR Word ServoPos1 = 1250 SEROUT Sdat, Baud+$8000,[noparse][[/noparse]"!SC", 5, 20, servoPos1.LOWBYTE, servoPos1.HIGHBYTE, CR] ServoPos2 = 250 SEROUT Sdat, Baud+$8000,[noparse][[/noparse]"!SC", 13, 20, servoPos2.LOWBYTE, servoPos2.HIGHBYTE, CR] END
In addition, the code above moves the robot foward, for some reason the servos will go in opposite directions with the same pulse widths (their orientation is the same)
Comments
ServoPos1 = 1250
SEROUT Sdat, Baud+$8000,[noparse][[/noparse]"!SC", 5, 20, servoPos1.LOWBYTE, servoPos1.HIGHBYTE, CR]
When you look at the bolded 20, this is the servo speed. If you set this value to 1 your servos will move as fast as they do in the program [noparse]:)[/noparse]
I hope this helps!!!!
Andy
"A man with a plan"
I didn't loop the signal, so it sent it once. What happened was, I guess the Stamp centers each servo when it is turned on, so this overrode the initial pulse in the program. I fixed this by adding a 3 sec pause before sending the pulses.
-Andy