EasyManua.ls Logo

Parallax Boe-Bot - Page 289

Parallax Boe-Bot
360 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 8: Robot Control with Distance Detection · Page 275
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} ' Stamp directive.
' {$PBASIC 2.5} ' PBASIC directive.
' -----[ Variables ]----------------------------------------------------------
freqSelect VAR Nib
irFrequency VAR Word
irDetectLeft VAR Bit
irDetectRight VAR Bit
distanceLeft VAR Nib
distanceRight VAR Nib
' -----[ Initialization ]-----------------------------------------------------
DEBUG CLS,
"IR OBJECT ZONE", CR,
"Left Right", CR,
"----- -----"
' -----[ Main Routine ]-------------------------------------------------------

Table of Contents

Other manuals for Parallax Boe-Bot