Page 212 ·
Robotics with the Boe-Bot
Testing Sensor Response to Flashlight Beam
Before you can program the Boe-Bot to turn towards a flashlight beam, you have to know
the difference between light readings with and without the flashlight beam shining in the
Boe-Bot’s path.
Example Program: TestBothPhotoresistors.bs2
√
Enter, save, and run TestBothPhotoresistors.bs2.
√
Place the Boe-Bot on the surface where it is to follow the flashlight beam. Make
sure it is still connected to the serial cable and that the measurements are
displaying in the Debug Terminal.
√
Record the values of both time measurements in the first row of Table 6-1.
√
Turn on your flashlight, and focus your beam in front of the Boe-Bot.
√
Your time measurements should now be significantly lower than the first set.
Record these new values of both time measurements in the second row of Table
6-1.
Table 6-1:
RC-Time Measurements With and Without Flashlight Beam
Duration Values
timeLeft
timeRight
Description
Time measurements with no flashlight beam (ambient
light).
Time measurements with flashlight beam focused in front
of the Boe-Bot.
' Robotics with the Boe-Bot - TestBothPhotoresistors.bs2
' Test Boe-Bot RC photoresistor circuits.
' {$STAMP BS2} ' Stamp directive.
' {$PBASIC 2.5} ' PBASIC directive.
timeLeft VAR Word ' Variable declarations.
timeRight VAR Word
DEBUG "PHOTORESISTOR VALUES", CR, ' Initialization.
"timeLeft timeRight", CR,
"-------- ---------"
DO ' Main routine.
HIGH 6 ' Left RC time measurement.