' {$STAMP BS2} ' {$PBASIC 2.5} DEBUG "Program Running!" irDetectLeft VAR BIT irDetectRight VAR BIT pulseLeft VAR WORD pulseRight VAR WORD loopCount VAR BYTE pulseCount VAR BYTE FREQOUT 4, 2000, 3000 DO FREQOUT 8, 1, 38500 irDetectLeft = IN9 FREQOUT 2, 1, 38500 irDetectRight = IN0 IF (irDetectLeft = 0) AND (irDetectRight = 0) THEN pulseCount = 2 pulseLeft = 850 pulseRight = 650 ELSEIF (irDetectRight = 1) THEN pulseCount = 10 pulseLeft = 650 pulseRight = 650 ELSEIF (irDetectLeft = 1) THEN pulseCount = 10 pulseLeft = 850 pulseRight = 850 ELSE pulseCount = 15 pulseLeft = 650 pulseRight = 850 ENDIF FOR loopCount = 1 TO pulseCount PULSOUT 13,pulseLeft PULSOUT 12,pulseRight PAUSE 20 NEXT FREQOUT 8, 1, 38500 irDetectLeft = IN9 FREQOUT 2, 1, 38500 irDetectRight = IN0 IF (irDetectLeft = 0) THEN HIGH 10 ELSE LOW 10 ENDIF IF (irDetectRight = 0) THEN HIGH 1 ELSE LOW 1 ENDIF DEBUG CRSRXY, 2, 3, BIN1 irDetectLeft, CRSRXY, 9, 3, BIN1 irDetectRight PAUSE 100 LOOP