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

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 Start Method
Here we replaced the
cog to run the
parameters.
The interface to an object is made up of its public (
has two interface components, the
Now our Output object can be used by other objects to toggle any pin at any rate for any
number of times they want. They can also choose to do this serially, by calling Output’s
Toggle
Let’s create another object that uses Output. To create a new object, select File → New from
the menu and a new edit tab will appear. In this new edit page, enter the following code. Pay
attention to the bold items, as we will discuss them soon.
Example Object: Blinker1.spin
{{ Blinker1.spin }}
OBJ
PUB Main
{Toggle pins at different rates, simultaneously}
Save this new object as “Blinker1.spin” in the same folder as you saved Output.spin. Now,
with Blinker1’s edit tab active, press F10 to compile and download. The LEDs should have
blinked in the same way they did in Exercise 5, but a different technique was used by the
code; Blinker1 used our Output object and simply called Output’s
Here’s how it worked. In Blinker1 we have an object block (
The object block’s
Output and that we’ll refer to it as
The Object-Method Reference
In the public method,
Exercise 4 that one method can call another just by referencing its name? That works for
methods that are in the same object, but now we need to call a method that is in another
object. To do this, we use the form object . method where object is the symbolic name we
LED : "Output"
LED.Start(16, 3_000_000, 10)
LED.Toggle(17, 2_000_000, 20)
method, or in parallel with other tasks, by calling Output’s
Toggle
LED : "Output"
Main
Main
method independently and passes along the
method with a
, we have two method calls. Remember how we learned in
LED
Start
line declares that we’re going to use another object called
within this Blinker1 object.
method and the
Start
method. The
PUB
) methods, so our Output object now
Toggle
OBJ
Start
Propeller Manual v1.0 · Page 111
method.
) and a public method (
Start
Start
method activates another
Pin
and
method.
,
Delay
Toggle
, and
methods.
Count
PUB
).

Related parts for 122-32000