Parallax Boe-Bot Student Manual page 229

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

Advertisement

Substitute your
value 114 in the
Substitute your
the value 20 in the
Substitute your
of the value 22 in the
Reconnect power to your board and servos.
Save and then run FlashlightControlledBoeBot.bs2.
Experiment and figure out exactly where to focus the light to get the forward,
left turn, and right turn maneuvers to execute.
Use the flashlight to guide your Boe-Bot through various obstacle courses and
maneuvers.
' -----[ Title ]--------------------------------------------------------------
' Robotics with the Boe-Bot - FlashlightControlledBoeBot.bs2
' Boe-Bot follows flashlight beam focused in front of it.
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Program Running!"
' -----[ Constants ]----------------------------------------------------------
' REPLACE THESE VALUES WITH THE VALUES YOU DETERMINED AND ENTERED INTO
' TABLE 6.1.
LeftAmbient
CON
RightAmbient
CON
LeftBright
CON
RightBright
CON
'
LeftThreshold
CON
RightThreshold CON
' -----[ Variables ]----------------------------------------------------------
' Declare variables for storing measured RC times of the
' left & right photoresistors.
timeLeft
VAR
timeRight
VAR
' -----[ Initialization ]-----------------------------------------------------
Chapter 6: Light Sensitive Navigation with Photoresistors · Page 215
measurement with no flashlight beam in place of the
timeRight
directive.
RightAmbient CON
measurement with focused flashlight beam in place of
timeLeft
directive.
LeftBright CON
measurement with focused flashlight beam in place
timeRight
RightBright CON
108
114
20
22
Average
LeftBright + LeftAmbient / 2
RightBright + RightAmbient / 2 * 5 / 8
Word
Word
directive.
' Stamp directive.
' PBASIC directive.
Scale factor
* 5 / 8

Advertisement

Table of Contents
loading

Table of Contents