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

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
The Toggle Method
Let’s look closely at the
Count)
method consisting of three parameters,
symbols that must be filled with values when the method is called; more on that in a moment.
Each parameter symbol is a long-sized (4-byte) variable that is local to the method; they are
all accessible within the method but not outside of the method. Parameter variables can be
modified within the method but those modifications do not affect anything outside the
method.
Now, our
Pin
parameters.
Inside of
Remember, in our previous examples the
Well, if you immediately follow
iterates the number of times indicated by the expression. In this case our
execute
begin to execute.
The Main Method
Now look at the
it causes the
parameter, and 10 for its
2_000_000, 20)
Delay
Notice that we put the
the first object is automatically executed when the application is started by the Propeller. We
are only using one object in this case, so
this application.
When
and it executes its function: blinking the LED on pin 16 five times with a delay of 1/4th
second in between. Then, because
returns to the caller,
2_000_000, 20)
on pin 17 ten times with a delay of 1/6th second in between. Finally, the
returns to
,
Delay
, and 20 for
Main
immediately to the right of its name. This creates a “parameter list” for our
Count
Toggle
Toggle
Main
’s first line,
and
Toggle
times, then it will stop, and any lines of code below the end of the loop will
, but it calls the
. When that line executes, the
again, but
, nothing changed except the
Main
Count
method can be called by other methods and given unique values to use as its
Count
method to execute using 16 for its
method.
Main
Main
.
Toggle(16, 3_000_000, 10)
symbols; it is more flexible since we can adjust its operational
Toggle
Main
, and execution continues at the next line of
Count
method above
Main
Toggle
has no more code to execute so it exits and the application
parameter. The following line looks similar,
method first. In its declaration, we added
REPEAT
’s first line,
Toggle
method with different values: 17 for
Pin
REPEAT
with an expression, it becomes a finite loop that
Main
,
Toggle
Delay
has no more code to execute after the loop, it
REPEAT
Toggle
Toggle(16, 3_000_000, 10
is automatically executed after we download
? Remember that the first public method in
loop was an infinite loop; it never stopped.
and
, is executed, the
command, which is now
method is called, and it blinks the LED
Count
Pin
parameter, 3 million for its
. A parameter list is one or more
Propeller Manual v1.0 · Page 105
Toggle
), is a method call;
Main
Pin
REPEAT
method is called
Toggle
repeat Count
(Pin, Delay,
, 2 million for
:
Toggle(17,
Toggle(17,
loop will
method
Toggle
Delay
.

Related parts for 122-32000