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

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 Stop Method
Our
conditional structure meaning “if the Cog variable is
block. ” Remember,
started. Since 0 means
actually started a cog.
The
statement is true. The
parameter:
Post-Set operator,
Post-Clear operator; it clears the variable preceding it to zero (0). These are called “post”
operators because they perform their duty “after” the variable’s original value is used by the
expression that it is involved in. So
value to the
statement stops the cog whose ID is
references to
The Active Method
The
FALSE
just set
be
the actual ID of the cog in use by this object.
The Toggle Method
We made a couple of minor but significant enhancements to the
look at the last line,
another cog and stores the ID of that cog in the
cog terminates as well, but the
the
Toggle
Remember we said we’d like to change
loop? Our next change achieves that in a clever way. The
times to toggle the pin. That means it doesn’t make sense to set
would want to toggle a pin zero times? So, we’ll make 0 an exception case that means
“toggle the pin infinitely.”
TRUE
Active
Stop
COGSTOP
Active
otherwise. The
to clear the
; that would have the additional advantage of being a true/false return value as well as
YesNo
method needs to stop the cog that was started by
and
Cog~ - 1
method is simple, it sets its return value,
COGSTOP
statement is indented below the
Cog
equal to
Start
reflect that there is no additional cog running.
Cog
~~
. This is another tricky but powerful expression in Spin. Remember the
command, then clears
Cog
, from earlier exercises? Well, a single
Cog~
methods into thinking its cog was still active. We put
>
Cog
variable to zero (0) to maintain the code’s integrity.
COGSTOP
symbol is the Is Greater Than operator. Note that we could also have
was set to 0 if no cog was started, and set to 1 through 8 if a cog was
FALSE
. Remember that if
since zero is considered to be
Cog
and non-0 means
command deactivates the cog whose ID is indicated by its
variable would be left holding the ID of that cog, fooling
Cog~ - 1
Toggle
Cog-1
Cog
IF
, then clears the
Start
to allow for an infinite loop as well as a finite
to zero (0). In effect, the
takes the value of
statement so it is executed only when the
Cog
TRUE
variable. When
is called, it runs the
YesNo
, the
TRUE
FALSE
Start
Count
, to
IF
execute the following indented
Propeller Manual v1.0 · Page 121
~
and non-zero is considered to
TRUE
statement is true only if we
Cog
. The
following a variable is the
Toggle
parameter is the number of
Cog
Count
variable to 0 so future
if
, subtracts 1, gives that
Toggle
if Cog
Cog
method. First, let’s
cogstop(Cog~ - 1)
equal to 0… who
Toggle
Cog~
is greater than 0,
terminates, that
statement is a
at the end of
method in
IF

Related parts for 122-32000