Boe bot is brought to us by Parallax Inc. and offers us a look into programming our own sensors. After buying the bot we begin by building it from parts and write code in PBASIC to transfer to the BASIC stamp in order to control the circuits. Boe Bot can navigate using the code given to it and report back its sensors statuses through light and sound.
DO
'FREQOUT 8, 1, 38500 ' Emit 38.5 kHz IR To Left 'irDetectLeft = IN9 ' Store IR Detection Values
'FREQOUT 2, 1, 38500 ' Emit 38.5 kHz IR To Right 'irDetectRight = IN0 ' Store IR Detection Values
'IF (irDetectLeft = 0) AND (irDetectRight = 0) THEN ' GOSUB Ping_Around ' Object Detected via IR Forward 'ELSEIF (irDetectLeft = 0) THEN ' GOSUB Ping_Around ' Object Detected via IR Left 'ELSEIF (irDetectRight = 0) THEN ' GOSUB Ping_Around ' Object Detected via IR Right 'ENDIF
'IF counter > 10 THEN ' Wait For 10 Servo Pulses GOSUB Ping_Out ' Activate PING))) 'ENDIF
IF (distance > 30) THEN ' Is Object Farther Than 30 cm? GOSUB Forward_Pulse ' If Yes Go Forward ELSE FREQOUT Piezo, 2000, 3000 GOSUB Ping_Around ' Otherwise Scan For Clear Path ENDIF