Parallax Boe-Bot Student Manual page 232

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

Advertisement

Page 218 · Robotics with the Boe-Bot
This is the subroutine that performs the
circuits. The measurement for the left circuit is stored in the
measurement for the right circuit is stored in the
Test_Photoresistors:
HIGH 6
PAUSE 3
RCTIME 6,1,timeLeft
HIGH 3
PAUSE 3
RCTIME 3,1,timeRight
RETURN
The Navigate subroutine uses an
against the
LeftThreshold
constant. Remember, when the
RightThreshold
means bright light is detected, and when it's large, it means the light is not as bright. So,
when one of the variables that stores an
threshold constant, it means the flashlight beam has been detected; otherwise, the
flashlight beam has not been detected. Depending on which condition this subroutine
detects (both, left, right or neither), the correct navigation pulses is applied, followed by a
before the
PAUSE
RETURN
Navigate:
IF(timeLeft<LeftThreshold)AND(timeRight<RightThreshold) THEN
PULSOUT 13, 850
PULSOUT 12, 650
ELSEIF (timeLeft < LeftThreshold) THEN
PULSOUT 13, 700
PULSOUT 12, 700
ELSEIF (timeRight < RightThreshold) THEN
PULSOUT 13, 800
PULSOUT 12, 800
ELSE
PULSOUT 13, 750
PULSOUT 12, 750
ENDIF
measurements on both photoresistor RC
RCTIME
timeRight
statement to compare the
IF...THEN
constant and the
RCTIME
command exits the subroutine.
variable, and the
timeLeft
variable.
timeLeft
variable against the
timeRight
measurement is small, it
RCTIME
measurement is smaller than the
variable

Advertisement

Table of Contents
loading

Table of Contents