Page 180 · Robotics with the Boe-Bot
PAUSE 20
NEXT
RETURN
Turn_Right:
FOR pulseCount = 0 TO 20
PULSOUT 13, 850
PULSOUT 12, 850
PAUSE 20
NEXT
RETURN
Back_Up:
FOR pulseCount = 0 TO 40
PULSOUT 13, 650
PULSOUT 12, 850
PAUSE 20
NEXT
RETURN
How Roaming with Whiskers Works
The
...
statements in the Main Routine section first check the whiskers for any
IF
THEN
states that require attention. If both whiskers are pressed (
turn is executed by calling the
subroutine twice in a row. If just the left whisker is pressed (
calls the
subroutine followed by the
Back_Up
whisker is pressed
(IN7 = 0
subroutine. The only possible combination that has not been covered is if
Turn_Left
neither whisker is pressed (
subroutine in this case.
Forward_Pulse
IF (IN5
= 0) AND (IN7 = 0) THEN
GOSUB Back_Up
GOSUB Turn_Left
GOSUB Turn_Left
ELSEIF (IN5
GOSUB Back_Up
GOSUB Turn_Right
ELSEIF (IN7
GOSUB Back_Up
GOSUB Turn_Left
ELSE
GOSUB Forward_Pulse
ENDIF
subroutine followed by calling the
Back_Up
), the
Back_Up
and
IN5 = 1
IN7 = 1
= 0) THEN
= 0) THEN
' Right turn, about 90-degrees.
' Back up.
and
IN5 = 0
IN7 = 0
), then the program
IN5 = 0
subroutine. If the right
Turn_Right
subroutine is called, followed by the
). The
command calls the
ELSE
), a U-
Turn_Left
Need help?
Do you have a question about the Boe-Bot and is the answer not in the manual?
Questions and answers