Parallax Boe-Bot Student Manual page 274

Hide thumbs Also See for Boe-Bot:
Table of Contents

Advertisement

Page 260 · Robotics with the Boe-Bot
pulseCount
The
statements now set the value of
IF...THEN
and
pulseRight
pulseLeft
forward.
IF (irDetectLeft = 0) AND (irDetectRight = 0) THEN
pulseCount = 1
pulseLeft = 850
pulseRight =
Else, if the right IR detector does not see the tabletop, rotate left 10 pulses.
ELSEIF (irDetectRight = 1) THEN
pulseCount = 10
pulseLeft = 650
pulseRight =
Else, if the left IR detector does not see the tabletop, rotate right 10 pulses.
ELSEIF (irDetectLeft = 1) THEN
pulseCount = 10
pulseLeft = 850
pulseRight =
Else, if neither detector can see the table top, back up 15 pulses and try again, hoping that
one of the detectors will see the drop-off before the other.
ELSE
pulseCount = 15
pulseLeft = 650
pulseRight =
ENDIF
Now that the value of
pulseCount
loop delivers the specified number of pulses for the maneuver determined by the
and
pulseLeft
pulseRight
FOR loopCount = 1 TO pulseCount
PULSOUT 13,pulseLeft
PULSOUT 12,pulseRight
PAUSE 20
VAR
Byte
pulseCount
. If both detectors can see the table, take one cautious pulse
650
650
850
850
,
, and
pulseLeft
variable.
as well as the values of
are set, this
pulseRight
FOR...NEXT

Advertisement

Table of Contents
loading

Table of Contents