Parallax Boe-Bot Student Manual page 272

Hide thumbs Also See for Boe-Bot:
Table of Contents

Advertisement

Page 258 · Robotics with the Boe-Bot
A second feature of a program for turning away from drop-offs is adjustable distance.
You may want your Boe-Bot to only take one pulse forward between checking the
detectors, but as soon as a drop-off is detected, you may want your Boe-Bot to take
several pulses worth of turn before checking the detectors again.
Just because you are taking multiple pulses in an evasive maneuver, it doesn't mean you
have to return to whiskers-style navigation. Instead, you can add a
that you can use to set to the number of pulses to deliver for a maneuver. The
command can be placed inside a
pulses. For one pulse forward,
can be set to 10, and so on.
Example Program – AvoidTableEdge.bs2
Open FastIrNavigation.bs2 and save it as AvoidTableEdge.bs2.
Modify the program so that it matches the example program. This will involve
adding variables, modifying the
commands inside a
and
pulseLeft
properly adjusted.
FastIrNavigation.bs2 because the rules of the course are different.
Reconnect your board and servos.
Test the program on your electrical tape delimited course.
If you decide to try a tabletop, remember to follow the testing and spotting tips
discussed earlier.
' Robotics with the Boe-Bot - AvoidTableEdge.bs2
' IR detects object edge and navigates to avoid drop-off.
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Program Running!"
irDetectLeft
VAR
irDetectRight
VAR
pulseLeft
VAR
pulseRight
VAR
loopCount
VAR
pulseCount
VAR
loop that executes
FOR...NEXT
can be 1, for ten pulses left,
pulseCount
IF...THEN
loop.
FOR...NEXT
variable values inside the
pulseRight
Their values are different from the ones in
Bit
Bit
Word
Word
Byte
Byte
pulseCount
FOR 1 TO pulseCount
statements, and nesting the
Be careful to make sure that all the
IF...THEN
' Variable declarations.
variable
PULSOUT
pulseCount
PULSOUT
statement are

Advertisement

Table of Contents
loading

Table of Contents