Chapter 4: Boe-Bot Navigation · Page 127
Moving Backward, Rotating, and Pivoting
All it takes to get other motions out of your Boe-Bot are different combinations of the
PULSOUT Duration arguments. For example, these two PULSOUT commands can be used
to make your Boe-Bot go backwards:
PULSOUT 13, 650
PULSOUT 12, 850
These two commands will make your Boe-Bot rotate in a left turn (counterclockwise as
you are looking at it from above):
PULSOUT 13, 650
PULSOUT 12, 650
These two commands will make your Boe-Bot rotate in a right turn (clockwise as you are
looking at it from above):
PULSOUT 13, 850
PULSOUT 12, 850
You can combine all these commands into a single program that makes the Boe-Bot
move forward, turn left, turn right, then move backward.
Example Program: ForwardLeftRightBackward.bs2
√ Enter, save, and run ForwardLeftRightBackward.bs2.
TIP – To enter this program quickly, use the BASIC Stamp Editor's Edit menu tools (Copy
and Paste) to make four copies of a FOR…NEXT loop. Then, adjust only the PULSOUT
Duration values and FOR…NEXT loop EndValues.
' Robotics with the Boe-Bot - ForwardLeftRightBackward.bs2
' Move forward, left, right, then backward for testing and tuning.
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Program Running!"
counter VAR Word
FREQOUT 4, 2000, 3000 ' Signal program start/reset.
FOR counter = 1 TO 64 ' Forward