Parallax Boe-Bot Student Manual page 168

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

Advertisement

Page 154 · Robotics with the Boe-Bot
LOOP UNTIL (pulseCount = 0)
The first time through the loop,
retrieve a value of 64 from the first address at the
variable. The second
pulseCount
address specified by the
The third
command retrieves a value of 650 from the first address specified by the
READ
label and places it in the
Pulses_Right
three values in the "0" column of the code snippet on page 153. When the value of those
variables are placed in the code block that follows, this:
FOR counter = 1 TO pulseCount
PULSOUT 13, pulseLeft
PULSOUT 12, pulseRight
PAUSE 20
NEXT
Do you recognize the basic maneuver generated by this code block?
Look at the other columns of the code snippet on page 153 and anticipate what
the
code block will look like on the second, third, and fourth times
FOR...NEXT
through the loop.
Look at the
LOOP UNTIL (pulseCount = 0)
The
operator stands for "not equal to". What will happen on the fifth time
<>
through the loop?
Enter, save, and run EepromNavigationWithWordValues.bs2.
' Robotics with the Boe-Bot - EepromNavigationWithWordValues.bs2
' Store lists of word values that dictate.
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Program Running!"
' -----[ Variables ]----------------------------------------------------------
counter
VAR
pulseCount
VAR
addressOffset
VAR
instruction
VAR
pulseRight
VAR
addressOffset
Pulses_Count
command retrieves a value of 850 from the first
READ
label, and places it in the
Pulses_Left
pulseRight
becomes
Word
Word
Byte
Byte
Word
= 0. The first
command will
READ
label, and place it in the
pulseLeft
variable. Notice that these are the
FOR counter = 1 TO 64
PULSOUT 13, 850
PULSOUT 12, 650
PAUSE 20
NEXT
statement in the program below.
' Stamp directive.
' PBASIC directive.
' Stores number of pulses.
' Stores offset from label.
' Stores EEPROM instruction.
' Stores servo pulse widths.
variable.

Advertisement

Table of Contents
loading

Table of Contents