so that they read
FREQOUT 2,1, irFrequency
irDetect = IN0
√
Modify TestLeftFrequencySweep.bs2 for testing the distance measurement of
the right IR LED/detector pair.
√
Run the program and verify that this pair can measure a similar distance.
Displaying Both Distances
It's useful at times to have a quick program you can run to test both the Boe-Bot's
distance detectors at the same time. This program is organized into subroutines, which
can be handy for copying and pasting into other programs that require distance detection.
Example Program – DisplayBothDistances.bs2
√
Enter, save, and run DisplayBothDistances.bs2.
√
Repeat the distance measurement exercise with a sheet of paper on each LED,
then on both LEDs at the same time.
' -----[ Title ]--------------------------------------------------------------
' Robotics with the Boe-Bot - DisplayBothDistances.bs2
' Test IR detector distance responses of both IR LED/detector pairs to
' frequency sweep.
' {$STAMP BS2}
' {$PBASIC 2.5}
' -----[ Variables ]----------------------------------------------------------
freqSelect
VAR
irFrequency
VAR
irDetectLeft
VAR
irDetectRight
VAR
distanceLeft
VAR
distanceRight
VAR
' -----[ Initialization ]-----------------------------------------------------
DEBUG CLS,
"IR OBJECT ZONE", CR,
"Left
Right", CR,
"-----
-----"
' -----[ Main Routine ]-------------------------------------------------------
Chapter 8: Robot Control with Distance Detection · Page 275
Nib
Word
Bit
Bit
Nib
Nib
' Stamp directive.
' PBASIC directive.
Need help?
Do you have a question about the Boe-Bot and is the answer not in the manual?