28125 Parallax Inc, 28125 Datasheet - Page 236

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
Now, the
large value when the lighting is low, and a small value when the lighting is bright.
Example Program – RoamingTowardTheLight.bs2
Unlike RoamingWithPhotoresistorDividers.bs2 on page 201, this program will be very
responsive to your hand casting a shadow over the photoresistor, regardless of whether
the light is bright or dim. This program does not need to change resistors depending on
the lighting conditions. Instead, it takes into account the lighting conditions and the
sensitivity adjustment is made in software using the
This program measures the overall average of
set the
to justify delivering a turning pulse.
difference
IF (timeLeft > timeRight + difference) THEN
ELSEIF (timeRight > timeLeft + difference) THEN ' Turn left.
ELSE
ENDIF
Enter, save, and run RoamingTowardTheLight.bs2
Take it to various areas, and let it roam, and verify that you can change its course
by casting a shadow over one of the photoresistor RC circuits, regardless of the
lighting conditions.
difference
For this program to work well, your photoresistors should respond similarly to similar
light levels. If the RC circuits are severely mismatched, your measurements from Table 6-1
will be very different under the same lighting conditions. You can correct these mismatched
measurements using techniques discussed in Appendix F: Balancing Photoresistors.
average = timeRight + timeLeft / 2
difference = average / 6
PULSOUT 13, 850
PULSOUT 12, 850
PULSOUT 13, 650
PULSOUT 12, 650
PULSOUT 13, 850
PULSOUT 12, 650
between the
variable can be used in this
timeLeft
and
timeLeft
timeRight
average
IF…THEN
and
measurements that’s needed
and
statement, and it will be a
timeRight
difference
' Turn right.
' Go forward.
and uses it to
variables.

Related parts for 28125