Figure 8-2: Frequencies and Zones for the Boe-Bot
15 14
13 12
Vd d
Red
Black
X4
X5
Vdd
Vin
Vs s
X3
P15
P14
P13
P12
Zone 0
Zone 1
P11
P10
P9
P8
P7
P6
P5
41500 Hz
40500 Hz
P4
+
P3
P2
P1
P0
X2
Boar d of Education
© 20 00 -2 00 3
You might be wondering why the value of zone 4 is 37.5 kHz and not 38.5 kHz. The
reason they are not the values that you would expect based on the % sensitivity graph is
because the
FREQOUT
37.5 kHz than it does at 38.5 kHz. The frequencies listed in Figure 8-2 are frequencies you
will program the BASIC Stamp to use to determine the distance of an object.
frequencies were determined using tests similar to the ones outlined in Appendix G: Tuning
IR Distance Detection.
In order to test the IR detector at each frequency, you will need to use
five different frequencies and test at each frequency to find out whether the IR detector
could see the object. The steps between each frequency are not quite even enough to use
the
...
loop's
FOR
NEXT
STEP
cumbersome. You could use five different
waste of code space. Instead, the best approach for storing a short list of values that you
want to use in sequence is a command called
command is:
LOOKUP
Index, [Value0, Value1, ...ValueN], Variable
If the
argument is 0,
Index
in
. If
Variable
Index
could be up to 256 values in the list, but for the next example program, we will only need
5. Here is how it will be used:
FOR freqSelect = 0 TO 4
LOOKUP freqSelect,[37500,38250,39500,40500,41500],irFrequency
Chapter 8: Robot Control with Distance Detection · Page 271
Object
Object
Zone 2
Zone 3
39500 Hz
38250 Hz
command transmits a slightly more powerful (harmonic) signal at
operator. You could use
FREQOUT
from the list inside the square braces will be placed
Value0
is 1,
from the list will be placed in
Value1
Zone 4
Zone 5
37500 Hz
No Detection
at any
Frequency
FREQOUT
and
, but that would be
DATA
READ
commands, but that would be a
. The syntax for the
LOOKUP
Variable
These
to send
LOOKUP
. There
Need help?
Do you have a question about the Boe-Bot and is the answer not in the manual?
Questions and answers