28125 Parallax Inc, 28125 Datasheet - Page 154
28125
Manufacturer Part Number
28125
Description
TEXT ROBOTICS
Manufacturer
Parallax Inc
Datasheet
1.28125.pdf
(360 pages)
Specifications of 28125
Title
Robotics with the Boe-Bot
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Not applicable / Not applicable
- Current page: 154 of 360
- Download datasheet (5Mb)
ACTIVITY #5: SIMPLIFY NAVIGATION WITH SUBROUTINES
In the next chapter, your Boe-Bot will have to perform maneuvers to avoid obstacles.
One of the key ingredients to avoiding obstacles is executing pre-programmed
maneuvers. One way of executing pre-programmed maneuvers is with subroutines. This
activity introduces subroutines, and also two different approaches to creating reusable
maneuvers with subroutines.
Inside the Subroutine
There are two parts of a PBASIC subroutine. One part is the subroutine call. It’s the
command in the program that tells it to jump to the reusable part of code, then come back
when it’s done. The other part is the actual subroutine. It starts with a label that serves
as its name and ends with a
the
to do.
RETURN
√
√
' Ramp up right rotate.
FOR pulseCount = 0 TO 30
NEXT
' Ramp down right rotate
FOR pulseCount = 30 TO 0
NEXT
Open ForwardLeftRightBackward.bs2 from Activity #1, and save it as
ForwardLeftRightBackwardRamping.bs2.
Modify the new program so your Boe-Bot will ramp into and out of each
maneuver. Hint: you might use the code snippets above, and similar snippets
from StartAndStopWithRamping.bs2.
PULSOUT 13, 750 + pulseCount
PULSOUT 12, 750 + pulseCount
PAUSE 20
PULSOUT 13, 750 + pulseCount
PULSOUT 12, 750 + pulseCount
PAUSE 20
command make up the code block that does the job you want the subroutine
RETURN
command. The commands between the label and
Related parts for 28125
Image
Part Number
Description
Manufacturer
Datasheet
Request
R
Part Number:
Description:
Microcontroller Modules & Accessories DISCONTINUED BY PARALLAX
Manufacturer:
Parallax Inc
Part Number:
Description:
BOOK UNDERSTANDING SIGNALS
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
COMPETITION RING FOR SUMOBOT
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
TEXT INFRARED REMOTE FOR BOE-BOT
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
BOARD EXPERIMENT+LCD NX-1000
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
CONTROLLER 16SERVO MOTOR CONTROL
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
BASIC STAMP LOGIC ANALYZER
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
IC MCU 2K FLASH 50MHZ SO-18
Manufacturer:
Parallax Inc
Datasheet: