Page 68 ·
Robotics with the Boe-Bot
the pulse will last. You can also figure out what the
PULSOUT
command's
Duration
argument has to be if you know how long you want the pulse to last. Just divide 2 µs into
the time you want the pulse to last. With this calculation:
750
s
000002
.
0
s
0015
.
0
s
2
duration
Pulse
argument
Duration
=
µ
=
we now know that the command for a 1.5 ms pulse to P12 will be
PULSOUT 12, 750
.
It’s best to only center one servo at a time, because that way you can hear when the motor
stops as you are adjusting it. This program will only send the center signal to the servo
connected to P12, and these next instructions will guide you through adjusting it. After
you complete the process with the servo connected to P12, you will repeat it with the
servo connected to P13.
√
If you have a Board of Education Rev C, make sure to set the 3-position power
switch to position-2 as shown in Figure 2-23.
0 1 2
Figure 2-23
Set the 3-Position Switch to
Position-2
√
If you are using the HomeWork Board, check the power connections to both
your BASIC Stamp and your servos. The 9 V battery should be attached to the
battery clip, and the 6 V battery pack should have all four batteries loaded.
If the servos start running (or twitching) as soon as you connect power
It's probably because the BASIC Stamp is running a program you ran in a previous activity.
√
Make sure to enter, save, and run CenterServoP12.bs2 before continuing to the
servo centering instructions that follow the example program.
√
Enter, save, and run CenterServoP12.bs2, then continue with the instructions that
follow the program.
Example Program: CenterServoP12.bs2
' Robotics with the Boe-Bot - CenterServoP12.bs2
' This program sends 1.5 ms pulses to the servo connected to