PAUSE 3
RCTIME 6,1,timeLeft
HIGH 3
PAUSE 3
RCTIME 3,1,timeRight
DEBUG CRSRXY, 0, 3,
DEC5 timeLeft,
"
",
DEC5 timeRight
PAUSE 100
LOOP
Your Turn
√
Try facing the Boe-Bot in different directions, and repeat your measurements.
√
For better results, you can average your measurements for "flashlight on" and
"flashlight off" and replace the values in Table 6-1 with your average values.
Following the Flashlight Beam
You have been using variable declarations up to this point. For example,
gives the name
Nib
counter
RAM. After you have declared the variable, every time you use
program, it uses the value stored at that particular location in the BASIC Stamp's RAM.
You can also declare constants. In other words, if you have a number you plan on using
in your program, give it a useful name. Instead of the
directive. Here are some
LeftAmbient
CON
RightAmbient
CON
LeftBright
CON
RightBright
CON
Now, everywhere in the program the name
use the number 108. Everywhere
value 114. Likewise, everywhere
is 22. You will substitute your values from Table 6-1 before running the
RightBright
program.
Chapter 6: Light Sensitive Navigation with Photoresistors · Page 213
to a particular memory location in the BASIC Stamp's
directives from the next example program:
CON
108
114
20
22
LeftAmbient
RightAmbient
LeftBright
' Right RC time measurement.
' Display measurements.
counter
directive, use the
VAR
is used, the BASIC Stamp will
is used, the BASIC Stamp will use the
appears, it's really the value 20, and
counter VAR
in a PBASIC
CON
Need help?
Do you have a question about the Boe-Bot and is the answer not in the manual?
Questions and answers