Page 86 · Robotics with the Boe-Bot
SUMMARY
This chapter guided you through connecting, adjusting, and testing the Parallax
Continuous Rotation servos. Along the way, a variety of PBASIC commands were
introduced. The
PAUSE command makes the program stop for brief or long periods of
time, depending on the
Duration argument you use. DO…LOOP makes repeating a single
or group of PBASIC commands over and over again efficient.
HIGH and LOW were
introduced as a way of making the BASIC Stamp connect an I/O pin to Vdd or Vss.
High and low signals were viewed with the help of an LED circuit. These signals were
used to introduce timing diagrams.
The
PULSOUT command was introduced as a more precise way to deliver a high or low
signal, and an LED circuit was also used to view signals sent by the
PULSOUT command.
DO…LOOP, PULSOUT, and PAUSE were then used to send the Parallax Continuous Rotation
servos the signal to stay still, which is 1.5 ms pulses every 20 ms. The servo was
adjusted with a screwdriver while receiving the 1.5 ms pulses until it stayed still. This
process is called “centering” the servo.
After the servos were centered, variables were introduced as a way to store values.
Variables can be used in math operations and counting.
FOR…NEXT loops were introduced
as a way to count.
FOR…NEXT loops control the number of times the code between the
FOR and NEXT statements are executed. FOR…NEXT loops were then used to control the
number of pulses delivered to a servo, which in turn controls the amount of time the
servo runs.
Questions
1. How do the Parallax Continuous Rotation servos differ from standard servos?
2. How long does a millisecond last? How do you abbreviate it?
3. What PBASIC commands can you use to make other PBASIC commands
execute over and over again?
4. What command causes the BASIC Stamp to internally connect one of its I/O
pins to Vdd? What command makes the same kind of connection, but to Vss?
5. What are the names of the different size variables that can be declared in a
PBASIC program? What size values can each size of variable store?
6. What is the key to controlling a Parallax Continuous Rotation servo’s speed and
direction? How does this relate to timing diagrams? How does it relate to