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

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
Using the example above, the methods that use them can do things like the following (assume
Mode
—or—
Notice that these routines do not rely on the exact value of the mode, but rather they rely on
the enumerated mode symbol itself for comparisons as well as the position of the symbol in
relation to other symbols in the same enumeration. It is important to write code this way to
decrease potentials for bugs introduced by future changes.
Enumerations don’t have to consist of comma-separated items either. The following also
works and leaves room for right-side comments about each mode.
CON
The above example does the same thing as the previous in-line example, but now we have
convenient room to describe the purpose of each mode without losing the automatic
incrementing advantage. Later on, if there’s a need to add a fifth mode, simply add it to the
list in whatever position is necessary. If there is a need for the list to begin at a certain value,
simply change the
It is even possible to modify the enumerated value in the middle of the list.
CON
Page 198 · Propeller Manual v1.0
case Mode
if Mode > RunVerbose
#0
RunTest
RunVerbose
RunBrief
RunFull
'Declare modes of operation
#1, RunTest, RunVerbose, #5, RunBrief, RunFull
is a symbol set by a calling object):
RunTest
RunVerbose : <verbose code here>
RunBrief
RunFull
<brief and run mode code here>
– Spin Language Reference
'Declare modes of operation
#0
: <test code here>
: <brief code here>
: <full code here>
to whatever you need:
'Run in test mode
'Run in verbose mode
'Run with brief prompts
'Run in full production mode
#1
,
#20
, etc.

Related parts for 122-32000