28125 Parallax Inc, 28125 Datasheet - Page 234

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
Figure 6-12: Photoresistor Orientation
Programming the Roaming Toward the Light Behavior
The key to roaming toward brighter light sources is going straight ahead when the
differences between the photoresistor measurements are small, and turning toward the
smaller photoresistor measurement when there is a large difference between the two
measurements. In effect, this means the Boe-Bot will turn toward bright light.
Initially this seems like a simple enough programming task;
example below should work. The problem is, it doesn’t because the Boe-Bot gets stuck
turning left and then right again because the change in
large. Each time the Boe-Bot turns a little, the
change so much that the Boe-Bot tries to correct and turn back. It never manages to get
any forward pulses in.
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
X2
Point the light collecting surfaces of your photoresistors upward and outward
shown in Figure 6-12.
IF (timeLeft > timeRight) THEN
ELSEIF (timeRight > timeLeft) THEN
X3
PULSOUT 13, 850
PULSOUT 12, 850
Vdd
+
Vin
Vss
timeRight
timeLeft
IF…THEN
' Turn right.
' Turn left.
and
and
timeLeft
reasoning like this
timeRight
variables
is too

Related parts for 28125