AvoidTableEdge

AvoidTableEdge - pulseLeft = 850 ' one pulse forward....

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
' Robotics with the Boe-Bot - AvoidTableEdge.bs2 ' IR detects object edge and navigates to avoid drop-off. ' ' {$STAMP BS2} ' {$PBASIC 2.5} ' irDetectLeft VAR Bit ' Variable declarations. irDetectRight VAR Bit pulseLeft VAR Word pulseRight VAR Word loopCount VAR Byte pulseCount VAR Byte p FREQOUT 4, 2000, 3000 ' Signal program start/reset. F DO ' Main Routine. D FREQOUT 8, 1, 38500 ' Check IR detectors. irDetectLeft = IN9 FREQOUT 2, 1, 38500 irDetectRight = IN0 ' Decide navigation. IF (irDetectLeft = 0) AND (irDetectRight = 0) THEN pulseCount = 1 ' Both detected,
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: pulseLeft = 850 ' one pulse forward. pulseRight = 650 ELSEIF (irDetectRight = 1) THEN ' Right not detected, pulseCount = 10 ' 10 pulses left. pulseLeft = 650 pulseRight = 650 ELSEIF (irDetectLeft = 1) THEN ' Left not detected, pulseCount = 10 ' 10 pulses right. pulseLeft = 850 pulseRight = 850 ELSE ' Neither detected, pulseCount = 15 ' back up and try again. pulseLeft = 650 pulseRight = 850 ENDIF FOR loopCount = 1 TO pulseCount ' Send pulseCount pulses PULSOUT 13,pulseLeft PULSOUT 12,pulseRight PAUSE 20 NEXT LOOP L...
View Full Document

This note was uploaded on 04/23/2010 for the course EECC 0306-201 taught by Professor Roymelton during the Spring '10 term at RIT.

Ask a homework question - tutors are online