28125 Parallax Inc, 28125 Datasheet - Page 199

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
Turn_Right:
Back_Up:
How EscapingCorners.bs2 Works
Since this program is a modified version of RoamingWithWhiskers.bs2, only new
features related to detecting and escaping corners are discussed here.
Three extra variables are created for detecting a corner. The nibble variable
store a value between 0 and 15. Since our target value for detecting a corner is 4, the size
of the variable is reasonable. Remember that a bit variable can store a single bit, either a
1 or a 0. The next two variables (
the right size for the job since they are used to store old values of
also bit variables.
These variables have to be initialized (given initial values). For the sake of making the
program easier to read,
Boe-Bot is stuck in a corner, it is reset to 1. The
so that it looks like one of the two whiskers was pressed some time before the program
started. This has to be done because the routine for detecting alternate corners always
compares an alternating pattern, either (
1
). Likewise,
NEXT
RETURN
FOR pulseCount = 0 TO 20
NEXT
RETURN
FOR pulseCount = 0 TO 40
NEXT
RETURN
PULSOUT 12, 650
PAUSE 20
PULSOUT 13, 850
PULSOUT 12, 850
PAUSE 20
PULSOUT 13, 650
PULSOUT 12, 850
PAUSE 20
counter
old7
old5
old5
and
counter
old7
VAR
VAR
VAR
have to be different from each other.
is set to 1, and when it gets to 4 due to the fact that the
old7
Nib
Bit
Bit
IN5 = 1
and
old5
and
old7
) are both bit variables. These are also
' Right turn, about 90-degrees.
' Back up.
IN7 = 0
and
old5
) or (
IN7
variables have to be set
IN5 = 0
and
IN5
counter
, which are
and
IN7 =
can

Related parts for 28125