while a certain condition exists.
. In this case, it causes the
(condition)
"Q" is read from EEPROM.
A
...
...
SELECT
CASE
ENDSELECT
on a case-by-case basis and execute code blocks accordingly. Here is the code block that
will look at each letter value held in the
appropriate subroutine for each instance, or case, of a given letter.
SELECT instruction
CASE "F": GOSUB Forward
CASE "B": GOSUB Backward
CASE "R": GOSUB Right_Turn
CASE "L": GOSUB Left_Turn
ENDSELECT
Here are these concepts, all together in a single program.
Example Program: EepromNavigation.bs2
√
Carefully read the code instructions and comments in EepromNavigation.bs2 to
understand what each part of the program does.
√
Enter, save, and run EepromNavigation.bs2.
' Robotics with the Boe-Bot - EepromNavigation.bs2
' Navigate using characters stored in EEPROM.
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Program Running!"
' -----[ Variables ]----------------------------------------------------------
pulseCount
VAR
address
VAR
instruction
VAR
' -----[ EEPROM Data ]--------------------------------------------------------
'
Address: 0123456789
'
||||||||||
DATA
"FLFFRBLBBQ"
' -----[ Initialization ]-----------------------------------------------------
Our example program will use
DO...LOOP
statement can be used to select a variable and evaluate it
instruction
Word
Byte
Byte
Chapter 4: Boe-Bot Navigation · Page 149
DO...LOOP UNTIL
to keep repeating until the character
variable and then call the
' Stamp directive.
' PBASIC directive.
' Stores number of pulses.
' Stores EEPROM address.
' Stores EEPROM instruction.
' These two commented lines show
' EEPROM address of each datum.
' Navigation instructions.
Need help?
Do you have a question about the Boe-Bot and is the answer not in the manual?
Questions and answers