Shop OBEX P1 Docs P2 Docs Learn Events
Passing Variables / Variable Pointers — Parallax Forums

Passing Variables / Variable Pointers

EricGarlicEricGarlic Posts: 41
edited 2009-05-16 21:49 in Propeller 1
Is there a comprehensive description of how to pass variable (variable pointers). E.g between cogs, between objects that are then loaded into cogs etc?

Comments

  • JonnyMacJonnyMac Posts: 9,195
    edited 2009-05-16 16:33
    There are probably lots of valid ways to skin that cat. I've attached a demo program that will be included in my July Nuts & Volts column.

    The LED object (jw_bicolor_v3.spin) provides color, bi-phase blinking, and pwm brightness control of a two-lead, bi-color (green/red) LED. The brightness is controlled by PWMing the dira control pin for one of the LEDs; I modulate the direction pin as it's a bi-color LED and current can be flowing in either direction at any given time. The object has a brightness control variable and a method for requesting the address of that variable.

    The demo program requests the address of the brightness variable and then uses that in another cog (running the fader method) that can ramp the brightness in one direction or the other.

    Again, this is just one way to do this, I'm sure the hardcore Propeller gurus will demonstrate others.
  • EricGarlicEricGarlic Posts: 41
    edited 2009-05-16 21:49
    Thanks. I'll Look it over.

    The propeller manual is a bit better than the last wrt variables
Sign In or Register to comment.