28125 Parallax Inc, 28125 Datasheet - Page 212

TEXT ROBOTICS

28125

Manufacturer Part Number
28125
Description
TEXT ROBOTICS
Manufacturer
Parallax Inc
Datasheet

Specifications of 28125

Title
Robotics with the Boe-Bot
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Not applicable / Not applicable
Example Program: TestPhotoresistorsDividers.bs2
This example program is TestWhiskers.bs2 adapted to the photoresistor dividers. Instead
of monitoring P5 and P7 as we did with the whiskers, we are now monitoring P3 and P6,
which are connected to the photoresistor divider circuits. This program should display a
value of 1 on both sides in a well-lit room. When you cast a shadow over one or both of
the photoresistors, their corresponding values should change to 0.
' Robotics with the Boe-Bot - TestPhotoresistorDividers.bs2
' Display what the I/O pins connected to the photoresistor
' voltage dividers sense.
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "PHOTORESISTOR STATES", CR,
DO
LOOP
DEBUG CRSRXY, 0, 3,
PAUSE 100
"Left
"-------
Reconnect power to your board.
Enter, save, and run TestPhotoresistorDividers.bs2.
Verify that with no shade, both
Verify that you can use your hand to cast a shadow over each of the
photoresistors and cause its input register to change from 1 to 0.
If you are having difficulty, either with getting a shadow to change the input
register to 0 or if the input registers store 0 regardless of whether or not you cast
a shadow over them, see the Photoresistor Divider Troubleshooting box after the
program listing.
photoresistor reliably changes the state from 1 to 0.
"P6 = ", BIN1 IN6,
"
P3 = ", BIN1 IN3
Right", CR,
--------"
Work on it until your hand casting a shadow over the
IN6
and
IN3
store the value 1.

Related parts for 28125