Chapter 7: Navigating with Infrared Headlights
· Page 249
√
Repeat with 2 k
Ω
resistors.
√
Repeat with 470
Ω
resistors.
√
Repeat with 220
Ω
resistors.
Table 7-2:
Detection Distance vs. Resistance
IR LED Series
Resistance, (
Ω
)
Maximum Detection Distance,
Circle one: ( in / cm )
4700
2000
1000
470
220
√
Before moving on to the next activity, restore your IR pairs to their original
configuration (with 1 k
Ω
resistors in series with each IR LED).
√
Also, before moving on, make sure to test this last change with
TestIrPairsAndIndicators.bs2 to verify that both IR LED/detector pairs are
working properly.
ACTIVITY #4: OBJECT DETECTION AND AVOIDANCE
An interesting thing about the IR detectors is that their outputs are just like the whiskers.
When no object is detected, the output is high; when an object is detected, the output is
low. In this activity, RoamingWithWhiskers.bs2 from page 178 is modified so that it
works with the IR detectors.
Converting the Whiskers Program for IR Object Detection/Avoidance
This next example program started as RoamingWithWhiskers.bs2. Aside from adjusting
the name and description, two bit variables were added to store the states of the IR
detectors.
irDetectLeft VAR Bit
irDetectRight VAR Bit
A routine was also added to read the IR pairs.
FREQOUT 8, 1, 38500