122-32000 Parallax Inc, 122-32000 Datasheet - Page 126

MANUAL PROPELLER

122-32000

Manufacturer Part Number
122-32000
Description
MANUAL PROPELLER
Manufacturer
Parallax Inc
Datasheets

Specifications of 122-32000

Accessory Type
Manual
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
For Use With/related Products
Propeller Education (PE) Kit
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
rather it uses a fixed index of 0. This means the
I/O pin 16 endlessly, suddenly has its
toggling P16 to immediately stop and start again but with P20 instead.
The final line,
loop that executes no additional code since there is nothing indented underneath it. If the
application cog stopped, the I/O pins it directed to be outputs may switch back to inputs,
causing strange-looking results due to the resistors between some pairs of LEDs on the
Propeller Demo Board. If you are not using the Propeller Demo Board, the first line and last
line of
The NextObject Method
We have six
any time. The point of the
postpone future operations until one is available. To do this, it scans through all six
objects looking for the first one that is not running as a parallel process and returns the
based index of that object. If all are currently running, it continues scanning until one
becomes available.
There are two nested
iterates as long as
loop works in the previous exercise.
The inner
called a “counted loop” and repeats the indented block below it but for each iteration it sets
the variable
etc., until the last iteration where
adjust the operation within a loop based on how many times the loop has executed.
The next line,
indented code below it if the
the value of
method of each of our
Once the condition is true (the
The
is contained within to terminate immediately. When this happens, execution continues with
the end of the outer
If all
be 6 (
starts over. If, however, an inactive
Page 126 · Propeller Manual v1.0
QUIT
LED
MAXLEDS
Main
objects are active, the inner loop will count, with
command is a special command for
REPEAT
are not necessary.
Index
Index
LED
) when it exits, causing the outer loop to iterate again and the whole process
repeat
if not LED[Index].Active
objects in this code and any number of them can be processing in parallel at
Index
from 0 through 5 as it executes, this conditional statement calls the
loop,
to a new value.
REPEAT
NextObject
, is only there to keep the application’s cog alive. It creates an endless
LED
REPEAT
repeat Index from 0 to MAXLEDS-1
equals
objects, in order.
loop, the “while” condition.
LED
NextObject
LED
uses our Output object’s
MAXLEDS
loops. The outer loop,
object at
Index
object at
Index
LED
Start
, 6 in this case. We learned how this type of
equals
method is to tell us which one is available and to
Index
object is found, the
is set to 0 for the first iteration, 1 for the second,
Index
, is a conditional statement that executes the
method called again. This causes the cog that is
REPEAT
MAXLEDS-1
is “not active.” Since the inner loop changes
LED
is not active) the next line,
object at index 0, which is busy toggling
loops only; it causes the
Active
, or 5. This is an excellent way to
repeat..while Index == MAXLEDS
Index
, is new to us, however. It is
Index
method to assist with this.
, from 0 to 5, then
value will be less than
quit
REPEAT
, executes.
Index
REPEAT
Active
loop it
LED
will
LED
-

Related parts for 122-32000