28125 Parallax Inc, 28125 Datasheet - Page 139

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
the same amount of time, the
Here’s an example program that will make the Boe-Bot roll forward for about three
seconds.
Example Program: BoeBotForwardThreeSeconds.bs2
' Robotics with the Boe-Bot - BoeBotForwardThreeSeconds.bs2
' Make the Boe-Bot roll forward for three seconds.
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Program Running!"
counter
FREQOUT 4, 2000, 3000
FOR counter = 1 TO 122
NEXT
END
How BoeBotForwardThreeSeconds.bs2 Works
From chapter 2, you already have lots of experience with the elements of this program: a
variable declaration, a
arguments, and
to the servos’ motions.
First a variable is declared that will be used in the
You should recognize this command; it generates a tone to signal the start of the program.
It will be used in all programs that run the servos.
PULSOUT 13, 850
PULSOUT 12, 650
PAUSE 20
Make sure power is connected to the BASIC Stamp and servos.
Enter, save, and run BoeBotForwardThreeSeconds.bs2.
counter VAR Word
FREQOUT 4, 2000, 3000
PAUSE
VAR
commands. Here’s a review of what each does and how it relates
FOR…NEXT
Word
EndValue
loop,
argument also controls the time the servo runs.
PULSOUT
FOR
' Signal program start/reset.
' Signal program start/reset.
' Run servos for 3 seconds.
commands with
...
NEXT
loop.
Pin
and
Duration

Related parts for 28125