EasyManuals Logo

Parallax Boe-Bot User Manual

Parallax Boe-Bot
360 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #279 background imageLoading...
Page #279 background image
Chapter 7: Navigating with Infrared Headlights · Page 265
' -----[ Main Routine ]------------------------------------------------
Main:
' Loop until something is detected
DO
GOSUB Check_IRs
LOOP UNTIL (irDetectLeft = 0) OR (irDetectRight = 0)
' Now start roaming -- this code from FastIrRoaming.bs2
DO
IF (irDetectLeft = 0) AND (irDetectRight = 0) THEN
pulseLeft = 650 ' Both detect
pulseRight = 850 ' Back up
ELSEIF (irDetectLeft = 0) THEN ' Left detect
pulseLeft = 850 ' Turn right
pulseRight = 850
ELSEIF (irDetectRight = 0) THEN ' Right detect
pulseLeft = 650 ' Turn left
pulseRight = 650
ELSE ' Nothing detected
pulseLeft = 850 ' Go forward
pulseRight = 650
ENDIF
PULSOUT 13, pulseLeft ' Apply the pulse.
PULSOUT 12, pulseRight
PAUSE 15
GOSUB Check_IRs ' Check IRs again
LOOP
' -----[ Subroutines ] ------------------------------------------------
Check_IRs:
FREQOUT 8, 1, 38500 ' Check IR Detectors
irDetectLeft = IN9
FREQOUT 2, 1, 38500
IrDetectRight = IN0
RETURN
P2. This behavior is in many ways the opposite of the roaming behavior covered in
this chapter. Instead of avoiding objects, the Boe-Bot tries to go toward the
objects. For this reason, the main code can be derived from
"FastIrRoaming.bs2", with a bit added that spins the Boe-Bot slowly until an
object is detected.
In the solution below, once the Boe-Bot has spied an object, it will continue
forward even if the detectors both read "no object" (1) for a few loops. This is
because, as the Boe-Bot is maneuvering toward the object, sometimes the

Table of Contents

Other manuals for Parallax Boe-Bot

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Parallax Boe-Bot and is the answer not in the manual?

Parallax Boe-Bot Specifications

General IconGeneral
BrandParallax
ModelBoe-Bot
CategoryRobotics
LanguageEnglish