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

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 Variable Pin Numbers
For Propeller objects, quite often it is necessary to monitor a single pin whose pin number is
specified outside the object itself. An easy way to translate that pin number into the proper
32-bit State and Mask value is by using the Bitwise Decode operator “
information). For example, if the pin number was specified by the variable
needed to wait until that pin is high, we could use the following code:
The Mask parameter,
corresponds to the pin number given by
Waiting for Transitions
If we needed to wait for a transition from one state to another (high-to-low, for example) we
could use the following code:
This example first waits for P5 to go high, then waits for it to go low; a high-to-low
transition. If we had used the second line of code without the first, the cog would not have
paused at all if P5 had been low to start with.
waitpeq(|< Pin, |< Pin, 0) 'Wait for Pin to go high
waitpeq(%100000, 5, 0)
waitpeq(%000000, 5, 0)
|< Pin
, evaluates to a long value where only one bit is high; the bit that
4: Spin Language Reference –
Pin
'Wait for Pin 5 to go high
'Then wait for Pin 5 to go low
.
Propeller Manual v1.0 · Page 327
|<
” (See 265 for more
Pin
, and we

Related parts for 122-32000