28125 Parallax Inc, 28125 Datasheet - Page 235

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
Here is another code block that works a little better. This code block fixes the turning
back and forth problem under certain conditions. The
larger than
Likewise,
the left. This gives the Boe-Bot the opportunity to apply enough forward pulses before it
has to correct with a turn, but only at certain light levels.
The problem with the code block above is that it works under medium dark conditions
only. If you take it into a much darker area, the Boe-Bot starts turning back and forth
again, and it never applies any forward pulses. If you take it into a brighter area, the Boe-
Bot just goes forward, and never makes any adjustments to the left or right.
Why does that happen?
Here is the answer: When the Boe-Bot is in a dark part of a room, the measurement for
each photoresistor will be large. For the Boe-Bot to decide to turn toward a light source,
the difference between these two measurements has to be large. When the Boe-Bot is in
a more brightly lit area, the measurement for each photoresistor will be smaller. For the
Boe-Bot to decide to make a turn, the difference between photoresistor measurements
also has to be much smaller than it was in the darker part of the room. The way to make
this difference respond to the lighting conditions is to make it a variable that is a fraction
of the average of
regardless whether the lighting is bright or dim.
ELSE
ENDIF
IF (timeLeft > timeRight + 15) THEN
ELSEIF (timeRight > timeLeft + 15) THEN
ELSE
ENDIF
timeRight
PULSOUT 13, 650
PULSOUT 12, 650
PULSOUT 13, 850
PULSOUT 12, 650
PULSOUT 13, 850
PULSOUT 12, 850
PULSOUT 13, 650
PULSOUT 12, 650
PULSOUT 13, 850
PULSOUT 12, 650
timeRight
timeRight
has to be larger than
by a margin of 15 before the Boe-Bot will apply a left pulse.
and
timeLeft
timeLeft
. That way, it will always be the right value,
by 15 before the Boe-Bot adjusts to
timeLeft
' Go forward.
' Turn right.
' Turn left.
' Go forward.
variable now has to be

Related parts for 28125