' Robotics with the Boe-Bot - ShadowGuidedBoeBot.

bs2 ' Boe-Bot detects shadows cast by your hand and tries to follow them.

' {$STAMP BS2} ' {$PBASIC 2.5}

' Stamp directive. ' PBASIC directive.

DEBUG "Program Running!" FREQOUT 4, 2000, 3000 ' Start/restart signal.

DO

IF (IN6 = 0) AND (IN3 = 0) THEN PULSOUT 13, 850 PULSOUT 12, 650 ELSEIF (IN6 = 0) THEN PULSOUT 13, 750 PULSOUT 12, 650 ELSEIF (IN3 = 0) THEN PULSOUT 13, 850 PULSOUT 12, 750 ELSE PULSOUT 13, 750 PULSOUT 12, 750 ENDIF

' Both detect shadows, forward.

' Left detects shadow, ' pivot left.

' Right detects shadow, ' pivot right.

' No shadow, sit still

PAUSE 20

' Pause between pulses.

LOOP .

Sign up to vote on this title
UsefulNot useful