Page 78 ·
Robotics with the Boe-Bot
√
Run the program and verify that the servo connected to P12 is now rotating
between 50 and 60 RPM clockwise.
' Robotics with the Boe-Bot – ServoP12Clockwise.bs2
' Run the servo connected to P12 at full speed clockwise.
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Program Running!"
DO
PULSOUT 12, 650
PAUSE 20
LOOP
Example Program: ServoP12Counterclockwise.bs2
You have probably anticipated that making the
PULSOUT
command’s
Duration
argument
greater than 750 will cause the servo to rotate counterclockwise. A
Duration
of 850 will
send 1.7 ms pulses as shown in Figure 2-26. This will make the servo turn full speed
counterclockwise.
Figure 2-26
A 1.7 ms Pulse
Train Makes the
Servo Turn Full
Speed
Counterclockwise
√
Save ServoP12Clockwise.bs2 as ServoP12Counterclockwise.bs2.
√
Modify the program by changing the
PULSOUT
command’s
Duration
argument
from 650 to 850.
√
Run the program and verify that the servo connected to P12 is now rotating
between 50 and 60 RPM counterclockwise.
' Robotics with the Boe-Bot – ServoP12Counterclockwise.bs2
' Run the servo connected to P12 at full speed counterclockwise.
' {$STAMP BS2}
' {$PBASIC 2.5}
Vdd (5 V)
Vss (0 V)
1.7 ms
1.7 ms
20 ms
www.parallax.com
standard servo