Parallax Boe-Bot Student Manual page 297

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

Advertisement

Get_Ir_Distances:
distanceLeft = 0
distanceRight = 0
FOR freqSelect = 0 TO 4
LOOKUP freqSelect,[37500,38250,39500,40500,41500], irFrequency
FREQOUT 8,1,irFrequency
irDetectLeft = IN9
distanceLeft = distanceLeft + irDetectLeft
FREQOUT 2,1,irFrequency
irDetectRight = IN0
distanceRight = distanceRight + irDetectRight
NEXT
RETURN
' -----[ Subroutine – Get Pulse ]---------------------------------------------
Send_Pulse:
PULSOUT 13,pulseLeft
PULSOUT 12,pulseRight
PAUSE 5
RETURN
How the FollowingBoeBot.bs2 Works
FollowingBoeBot.bs2 declares four constants,
using the
directive. Everywhere you see
CON
constant). Likewise, everywhere you see either
actually 35, and
CenterPulse
Kpl
Kpr
SetPoint
CenterPulse
The first thing the main routine does is call the
subroutine is finished,
Get_Ir_Distances
contain a number corresponding to the zone in which an object was detected for both the
left and right IR pairs.
DO
GOSUB Get_Ir_Distances
Chapter 8: Robot Control with Distance Detection · Page 283
,
Kpr
SetPoint
Kpl
is 750.
CON
-35
CON
35
CON
2
CON
750
Get_Ir_Distances
distanceLeft
, and
Kpl, SetPoint
CenterPulse
, it's actually the number 2 (a
, it's actually the number -35.
subroutine. After the
and
distanceRight
is
Kpr
each

Advertisement

Table of Contents
loading

Table of Contents