28125 Parallax Inc, 28125 Datasheet - Page 200

TEXT ROBOTICS

28125

Manufacturer Part Number
28125
Description
TEXT ROBOTICS
Manufacturer
Parallax Inc
Datasheet

Specifications of 28125

Title
Robotics with the Boe-Bot
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Not applicable / Not applicable
Now we get to the Detect Consecutive Alternate Corners section. The first thing we want
to check for is if one or the other whisker is pressed. A simple way to do this is to ask “is
IN7
statement:
If it is indeed one whisker that is pressed, the next thing to check for is whether or not it’s
the exact opposite pattern as the previous time. In other words, is
is
alternate whisker contacts. It’s also time to remember the current whisker pattern by
setting
If it turns out that this is the fourth consecutive whisker contact, then it’s time to reset the
counter to 1 and execute a U-turn.
This
This
statement. The
other words, it must not be an alternate whisker that was pressed, so reset the counter
because the Boe-Bot is not stuck in a corner.
(old5 <> IN5)
different from
ENDIF
ELSE
old7
counter = 1
old7 = 0
old5 = 1
statement is connected to the
IF (IN7 <> IN5) THEN
ends the code block that is executed if
equal to the current
IF (old7 <> IN7) AND (old5 <> IN5) THEN
counter = counter + 1
old7 = IN7
old5 = IN5
IF (counter > 4) THEN
ENDIF
ELSE
counter = 1
GOSUB Back_Up
GOSUB Turn_Left
GOSUB Turn_Left
? If that’s true, then, it’s time to add one to the counter that tracks
IN5
statement covers what happens if the
?” In PBASIC, we can use the not-equal operator
IN7
and
IF (old7 <> IN7) AND (old5 <> IN5) THEN
old5
equal to the current
counter
> 4.
IF
statement is not true. In
IN5
(old7 <> IN7)
.
<>
in an
and
IF

Related parts for 28125