Datasheet
Chapter 3: EEPROM Tricks and Program Tips ยท Page 79
to the header. The right column shows the components that you plugged into the header,
the IR receiver, and shielded IR LED.
Figure 3-2 IR Object Detection Circuits
Testing the front left IR detector involves sending a 38500 kHz signal to P4, then
immediately storing the value sensed at P11 in a bit variable. Here is an example of some
PBASIC code that will do this:
irLF VAR Bit
.
.
.
FREQOUT 4, 1, 38500
irLF = IN11
The SumoBot's IR receivers are designed to send a low signal to the BASIC Stamp
whenever they detect infrared light flashing on/off at frequencies in the neighborhood of 38.5
kHz. 38.5 kHz is 38,500 on/off cycles per second. The IR receivers send a high signal if
they do not see IR flashing on/off at that rate.
To detect objects, the SumoBot's BASIC Stamp has to use its IR LED headlights to shine
infrared flashing on/off at 38,500 times per second. If the infrared is reflected off an object
and bounces back, the IR receiver will detect it.
The command FREQOUT Pin, Duration, 38500 actually sends a harmonic signal at
38.5 kHz. The IR receivers can't really tell the difference between a fundamental and a
harmonic. To learn more about this and other IR object detection techniques, see Chapters
7 and 8 in Robotics with the Boe-Bot.