EasyManua.ls Logo

Parallax Boe-Bot - Page 229

Parallax Boe-Bot
360 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 6: Light Sensitive Navigation with Photoresistors · Page 215
Substitute your timeRight measurement with no flashlight beam in place of the
value 114 in the
RightAmbient CON directive.
Substitute your
timeLeft measurement with focused flashlight beam in place of
the value 20 in the
LeftBright CON directive.
Substitute your
timeRight measurement with focused flashlight beam in place
of the value 22 in the
RightBright CON directive.
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} ' Stamp directive.
' {$PBASIC 2.5} ' PBASIC directive.
DEBUG "Program Running!"
' -----[ Constants ]----------------------------------------------------------
' REPLACE THESE VALUES WITH THE VALUES YOU DETERMINED AND ENTERED INTO
' TABLE 6.1.
LeftAmbient CON 108
RightAmbient CON 114
LeftBright CON 20
RightBright CON 22
' Average Scale factor
LeftThreshold CON LeftBright + LeftAmbient / 2 * 5 / 8
RightThreshold CON RightBright + RightAmbient / 2 * 5 / 8
' -----[ Variables ]----------------------------------------------------------
' Declare variables for storing measured RC times of the
' left & right photoresistors.
timeLeft VAR Word
timeRight VAR Word
' -----[ Initialization ]-----------------------------------------------------

Table of Contents

Other manuals for Parallax Boe-Bot