Parallax Boe-Bot Student Manual page 238

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

Advertisement

Page 224 · Robotics with the Boe-Bot
' -----[ Subroutine - Average_And_Difference ]--------------------------------
Average_And_Difference:
average = timeRight + timeLeft / 2
difference = average / 6
RETURN
' -----[ Subroutine - Navigate ]----------------------------------------------
Navigate:
' Shadow significantly stronger on left detector, turn right.
IF (timeLeft > timeRight + difference) THEN
PULSOUT 13, 850
PULSOUT 12, 850
' Shadow significantly stronger on right detector, turn left.
ELSEIF (timeRight > timeLeft + difference) THEN
PULSOUT 13, 650
PULSOUT 12, 650
' Shadows in same neighborhood of intensity on both detectors.
ELSE
PULSOUT 13, 850
PULSOUT 12, 650
ENDIF
PAUSE 10
RETURN
Why
PAUSE 10
subroutine has two
the
commands. Both these factors add to the amount of time between servo
RCTIME
pulses, so the
PAUSE
and error experiments,
performance over the widest range of light levels.
Your Turn – Adjusting the Sensitivity to Differences in Light
Right now, the
difference
by a smaller value if you want to make the Boe-Bot less sensitive to differences
average
in light or divide it by a larger value if you want to make the Boe-Bot more sensitive to
differences in light level.
instead of
PAUSE 20?
commands adding up to 6 ms plus some extra time to execute
PAUSE
in the
subroutine has to be reduced. After some trial
Navigate
appeared to give the servos the most reliable
PAUSE 10
variable is the
average
Because the
Test_Photoresistors
divided by 6. You can divide

Advertisement

Table of Contents
loading

Table of Contents