28125 Parallax Inc, 28125 Datasheet - Page 158

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
Backward:
You should recognize the pattern of movement your Boe-Bot makes; it is the same one
made by ForwardLeftRightBackward.bs2. Clearly there are many different ways to
structure a program that will result in the same movements. A third approach is given in
the example below.
Example Program – MovementsWithVariablesAndOneSubroutine.bs2
Here’s another example program that causes your Boe-Bot to perform the same
maneuvers, but it only uses one subroutine and some variables to do it.
You have surely noticed that up to this point each Boe-Bot maneuver has been
accomplished with similar code blocks. Compare these two snippets:
' Forward full speed
FOR counter = 1 TO 64
NEXT
What causes these two code blocks to perform different maneuvers are changes to the
FOR StartValue
These arguments can be variables, and these variables can be changed repeatedly during
program run time to generate different maneuvers. Instead of using separate subroutines
with specific
the same subroutine over and over. The key to making different maneuvers is to set the
variables to the correct values for the maneuver you want before calling the subroutine.
PAUSE 200
RETURN
FOR counter = 1 TO 64
NEXT
RETURN
PULSOUT 13, 850
PULSOUT 12, 650
PAUSE 20
PULSOUT 13, 650
PULSOUT 12, 850
PAUSE 20
PULSOUT Duration
and
EndValue
arguments for each maneuver, the program below uses
arguments, and the
' Ramp down from full speed backwards
FOR pulseCount = 100 TO 1
NEXT
PULSOUT 13, 750 - pulseCount
PULSOUT 12, 750 + pulseCount
PAUSE 20
PULSOUT Duration
arguments.

Related parts for 28125