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

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
Public Method Declaration
Public Method declarations begin with
and an optional set of parameters, a result variable, and local variables.
Example:
PUB Init
PUB MotorPos : Position
PUB MoveMotor(Position, Speed) : Success | PosIndex
This example contains three public methods,
method has no parameters and declares no return value or local variables. The
method has no parameters but declares a return value called
method has two parameters,
PosIndex
All executable statements that belong to a
indented by at least one space.
The Return Value
Whether or not a
that defaults to zero (0). There is a pre-defined name for this return value within every
method, called
variable and, upon exiting the method, the current value of
caller.
interchangeably with the built-in
sets “
this, it is considered good practice to give a descriptive name to the return value (in the
declaration) for any method whose return value is significant. Likewise, it is good practice to
leave the return value unnamed (in the
unimportant and unused.
Page 288 · Propeller Manual v1.0
<initialization code>
Position := <code to retrieve motor position>
<code that moves motor to Position at Speed and returns True/False>
Position := …
– Spin Language Reference
.
In addition, if a
RESULT
PUB
” and could also have used “
declaration specifies a RValue , there is always an implied return value
. At any time within a method,
RESULT
Position
RESULT
is declared for the method, that name can be used
and
PUB
PUB
variable. For instance, the
Speed
declaration) for any method whose return value is
, in column 1 of a line, followed a unique name
PUB
, a return value,
Init
Result := …
method appear underneath its declaration,
,
MotorPos
RESULT
RESULT
can be updated like any other
” for the same effect. Despite
Success
and
Position
will be passed back to the
MotorPos
MoveMotor
, and a local variable,
. The
method above
. The
MoveMotor
MotorPos
Init
PUB
PUB

Related parts for 122-32000