![Parallax Boe-Bot Student Manual Download Page 255](http://html2.mh-extra.com/html/parallax/boe-bot/boe-bot_student-manual_3646721255.webp)
Chapter 7: Navigating with Infrared Headlights
· Page 241
' {$PBASIC 2.5}
irDetectLeft VAR Bit
DO
FREQOUT 8, 1, 38500
irDetectLeft = IN9
DEBUG HOME, "irDetectLeft = ", BIN1 irDetectLeft
PAUSE 100
LOOP
√
Leave the Boe-Bot connected to the serial cable, because you will be using the
Debug Terminal to test your IR pair.
√
Place an object, such as your hand or a sheet of paper, about an inch from the left
IR pair, in the manner shown in Figure 7-1 on page 236.
√
Verify that when you place an object in front of the IR pair the Debug Terminal
displays a 0, and when you remove the object from in front of the IR pair, it
displays a 1.
√
If the Debug Terminal displays the expected values for object not detected (1)
and object detected (0), move on to the Your Turn section following the example
program.
√
If the Debug Terminal does not display the expected values, try the steps in the
Trouble-Shooting box.
Trouble-Shooting
If the Debug Terminal does not display the expected values, check for circuit and program
entry errors.
If you are always getting 0, even when an object is not placed in front of the Boe-Bot, there
may be a nearby object that is reflecting the infrared. The surface of the table in front of the
Boe-Bot is a common culprit. Move the Boe-Bot so that the IR LED and detector cannot
possibly be reflecting off any nearby object.
If the reading is 1 most of the time when there is no object in front of the Boe-Bot, but
flickers to 0 occasionally, it may mean you have interference from a nearby fluorescent light.
Turn off any nearby fluorescent lights and repeat your tests.
Your Turn
√
Save TestLeftIrPair.bs2 as TestRightIrPair.bs2.