Chapter 2: Your Boe-Bot’s Servo Motors · Page 57
DO
PULSOUT 13, 65000
PULSOUT 12, 65000
PAUSE 2000
LOOP
Your Turn – Viewing the Full Speed Servo Signal
Remember the servo signal is 100 times as fast as the program you just ran. First, let’s
try running the program ten times as fast. That means divide all the
Duration arguments
(
PULSOUT and PAUSE) by 10.
√ Modify the program so that the commands look like this:
DO
PULSOUT 13, 6500
PULSOUT 12, 6500
PAUSE 200
LOOP
√ Run the modified program and verify that it makes the LEDs blink ten times as
fast.
Now, let’s try 100 times as fast (one hundredth of the duration). Instead of appearing to
flicker, the LED will just appear to be not as bright as it would when you send it a simple
high signal. That’s because the LED is flashing on and off so quickly and for such brief
periods of time that the human eye cannot detect the actual on/off flicker, just a change in
brightness.
√ Modify the program so that the commands look like this:
DO
PULSOUT 13, 650
PULSOUT 12, 650
PAUSE 20
LOOP
√ Run the modified program and verify that it makes both LEDs about the same
brightness.
√ Try substituting 850 in the
Duration argument for the PULSOUT command that
goes to P13.
DO