EasyManua.ls Logo

Parallax Boe-Bot - Page 290

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...
Page 276 · Robotics with the Boe-Bot
DO
GOSUB Get_Distances
GOSUB Display_Distances
LOOP
' -----[ Subroutine – Get_Distances ]-----------------------------------------
Get_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
PAUSE 100
NEXT
RETURN
' -----[ Subroutine – Display_Distances ]-------------------------------------
Display_Distances:
DEBUG CRSRXY,2,3, DEC1 distanceLeft,
CRSRXY,9,3, DEC1 distanceRight
RETURN
Your Turn – More Distance Tests
Try measuring the distance of different objects and find out if the color and/or
texture make any difference to the distance measurement.

Table of Contents

Other manuals for Parallax Boe-Bot