Futaba servos out of control after modification!
Miltos
Posts: 16
After reading a lot of articles "how to modify a standard servo for continous rotation", I succesfully alter my futaba s3003 for continous rotation. Nevertheless the servos run with non stop for a counter loop from 1 to 256 (and above), see code below:
How can I make the servos run for let's say 2 min...as any end value above 250 will make them run for ever???
Any help will be much appreciated.
' {$STAMP BS2}' {$PBASIC 2.5} '------------- Variables -------------- counter VAR Byte 'variable for PULSOUT loop PBin VAR IN2 'PushButton for PIN2 '------------- Constants --------------- SERVO_Right CON 12 ' Right Servo SERVO_Left CON 13 ' Left Servo start: FOR counter = 1 TO 259 PULSOUT SERVO_Left, 850 PULSOUT SERVO_Right, 650 PAUSE 20 NEXT standby: DEBUG "Stanby mode",CR IF PBin = 0 THEN start GOTO standby:
How can I make the servos run for let's say 2 min...as any end value above 250 will make them run for ever???
Any help will be much appreciated.
Comments
There is no direct way to make the servos move for a period of time. Normally this is done by putting out a control pulse every 20ms for a total of say 2 minutes. That's 120 seconds or 6000 pulses. You'd make your FOR loop run for 6000 pulses so the servos would run for 2 minutes. You'd have to make your counter be a word variable instead of a byte variable.
And while you're for/nexting, try this fun speed-changing code on your CR servos:
counter var word
xcounter var word
FOR counter = 500 TO 1000
xcounter=1500-counter
PULSOUT SERVO_Left, counter
PULSOUT SERVO_Right, xcounter
PAUSE 20
NEXT