Parallax Boe-Bot Student Manual page 139

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

Advertisement

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
Make sure power is connected to the BASIC Stamp and servos.
Enter, save, and run 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
VAR
FREQOUT 4, 2000, 3000
FOR counter = 1 TO 122
PULSOUT 13, 850
PULSOUT 12, 650
PAUSE 20
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
commands. Here's a review of what each does and how it relates
PAUSE
to the servos' motions.
First a variable is declared that will be used in the
counter VAR Word
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.
FREQOUT 4, 2000, 3000
argument also controls the time the servo runs.
EndValue
Word
loop,
FOR...NEXT
PULSOUT
Chapter 4: Boe-Bot Navigation · Page 125
' Signal program start/reset.
' Run servos for 3 seconds.
commands with
Pin
...
loop.
FOR
NEXT
' Signal program start/reset.
and
Duration

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the Boe-Bot and is the answer not in the manual?

Questions and answers

Table of Contents

Save PDF