EasyManuals Logo

Parallax Boe-Bot User Manual

Parallax Boe-Bot
360 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #156 background imageLoading...
Page #156 background image
Page 142 · Robotics with the Boe-Bot
DEBUG "Command in subroutine", CR
PAUSE 1000
RETURN
Watch your Debug Terminal, and press the
Reset button a few times. You
should get the same set of three messages in the right order each time.
Here’s an example program that has two subroutines. One subroutine makes a high
pitched tone while the other makes a low pitched tone. The commands between
DO and
LOOP call each of the subroutines in turn. Try this program and note the effect.
Example Program – TwoSubroutines.bs2
Enter, save, and run TwoSubroutines.bs2
' Robotics with the Boe-Bot - TwoSubroutines.bs2
' This program demonstrates that a subroutine is a reusable block of commands.
' {$STAMP BS2}
' {$PBASIC 2.5}
DO
GOSUB High_Pitch
DEBUG "Back in main", CR
PAUSE 1000
GOSUB Low_Pitch
DEBUG "Back in main again", CR
PAUSE 1000
DEBUG "Repeat...",CR,CR
LOOP
High_Pitch:
DEBUG "High pitch", CR
FREQOUT 4, 2000, 3500
RETURN
Low_Pitch:
DEBUG "Low pitch", CR
FREQOUT 4, 2000, 2000
RETURN
Let’s try putting the forward, left, right, and backward navigation routines inside
subroutines. Here’s an example:

Table of Contents

Other manuals for Parallax Boe-Bot

Questions and Answers:

Question and Answer IconNeed help?

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

Parallax Boe-Bot Specifications

General IconGeneral
BrandParallax
ModelBoe-Bot
CategoryRobotics
LanguageEnglish