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 #162 background imageLoading...
Page #162 background image
Page 148 · Robotics with the Boe-Bot
familiar code blocks in subroutines for each basic maneuver. Each maneuver is given a
one-letter code as a reference. Long lists of these code letters can be stored in EEPROM
and then read and decoded during program execution. This avoids the tedium of
repeating long lists of subroutines, or having to change the variables before each
GOSUB
command.
This programming approach requires some new PBASIC instructions: the
DATA directive,
and
READ and SELECT...CASE...ENDSELECT commands. Let’s take a look at each before
trying out an example program.
Each of the basic maneuvers is given a single letter code that will correspond to its
subroutine: F for
Forward, B for Backward, L for Left_Turn, and R for Right_Turn.
Complex Boe-Bot movements can be quickly choreographed by making a string of these
code letters. The last letter in the string is a Q, which will mean “quit” when the
movements are over. The list is saved in EEPROM during program download with the
DATA directive, which looks like this:
DATA "FLFFRBLBBQ"
Each letter is stored in a byte of EEPROM, beginning at address 0 (unless we tell it to
start somewhere else). The READ command can then be used to get this list back out of
EEPROM while the program is running. These values can be read from within a
DO…LOOP like this:
DO UNTIL (instruction = "Q")
READ address, instruction
address = address + 1
' PBASIC code block omitted here.
LOOP
The
address variable is the location of each byte in EEPROM that is holding a code
letter. The
instruction variable will hold the actual value of that byte, our code letter.
Notice that each time through the loop, the value of the
address variable is increased by
one. This will allow each letter to be read from consecutive bytes in the EEPROM,
starting at address 0.
The DO…LOOP command has optional conditions that are handy for different
circumstances. The
DO UNTIL (condition)...LOOP allows the loop to repeat until a
certain condition occurs.
DO WHILE (condition)...LOOP allows the loop to repeat only

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