122-32000 Parallax Inc, 122-32000 Datasheet - Page 110
122-32000
Manufacturer Part Number
122-32000
Description
MANUAL PROPELLER
Manufacturer
Parallax Inc
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
- Current page: 110 of 438
- Download datasheet (5Mb)
Exercise 6: Output.spin & Blinker1.spin – Using Our Object
Now let’s explore the power of objects. All of the preceding exercises created an application
that contained only one object; the Output.spin object is the entire application. This is typical
of how new objects begin their development. Suppose that the motivation behind all this
work was really to create an object other developers could use to easily toggle one or more
I/O pins. Yes, it may be silly to create an object for such a use, but let’s have fun with it
anyway!
It’s time to make our Output object easily interface with other objects. Edit your code to look
like the following:
Example Object: Output.spin
{{ Output.spin }}
Toggle two pins, one after another.}}
VAR
PUB Main
PUB Start(Pin, Delay, Count)
{{Start new toggling process in a new cog.}}
PUB Toggle(Pin, Delay, Count)
{{Toggle Pin, Count times with Delay clock cycles in between.}}
Be sure to save this object with the filename “Output.spin” for later use by our next object.
Page 110 · Propeller Manual v1.0
long Stack[9]
cognew(Toggle(16, 3_000_000, 10), @Stack)
Toggle(17, 2_000_000, 20)
cognew(Toggle(Pin, Delay, Count), @Stack)
dira[Pin]~~
repeat Count
!outa[Pin]
waitcnt(Delay + cnt)
'Stack space for new cog
'Set I/O pin to output direction
'Repeat for Count iterations
' Toggle I/O Pin
' Wait for Delay cycles
'Toggle P16 ten…
'Toggle P17 twenty…
Related parts for 122-32000
Image
Part Number
Description
Manufacturer
Datasheet
Request
R
Part Number:
Description:
MANUAL FOR SUMOBOT
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
GUIDE STUDENT PROCESS CONTROL
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
GUIDE STUDENT SMART SENSORS
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
LEAD WIRES FLYING CABLE III/IV
Manufacturer:
Xilinx Inc
Datasheet:
Part Number:
Description:
BOARD ADAPTER AND FLY LEADS
Manufacturer:
Xilinx Inc
Datasheet:
Part Number:
Description:
PLATFORM CABLE USB II
Manufacturer:
Xilinx Inc
Datasheet:
Part Number:
Description:
KIT STARTER COOLRUNNER-II BUNDLE
Manufacturer:
Xilinx Inc
Datasheet:
Part Number:
Description:
Microcontroller Modules & Accessories DISCONTINUED BY PARALLAX
Manufacturer:
Parallax Inc
Part Number:
Description:
Microcontroller Modules & Accessories DISCONTINUED BY PARALLAX
Manufacturer:
Parallax Inc
Part Number:
Description:
BOOK UNDERSTANDING SIGNALS
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
BOARD EXPERIMENT+LCD NX-1000
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
IC MCU 2K FLASH 50MHZ SO-18
Manufacturer:
Parallax Inc
Datasheet: