Shop OBEX P1 Docs P2 Docs Learn Events
Multi-phase, bi-color LED control — Parallax Forums

Multi-phase, bi-color LED control

JonnyMacJonnyMac Posts: 9,208
edited 2010-05-14 16:04 in Propeller 1
I really like using bi-color LEDs; they're cheap and with a little code can provide a lot of information to the product user.· In the past I had written code that allowed a simple bi-color (2- or 3-lead) LED·to be a solid color or flash between two colors, and even have the ability to fade.· I found I never used the fading feature and wanted more phases so I've created this version of the object to do just that.

This version (jm_bicolor_v4.spin) allows me to control the LED using 1 to 4 phases, with each phase having a color setting (off, red, green, yellow) and duration (1ms to 1min).· The duration only matters when using 2 to 4 phases, of course; this sets the blink characteristics.· The object does allow you to control the yellow color mix with a constant, or to pass it (you specify the percentage of red) using the initx() method.

Everything seems to work just fine, but I'm going to wring this out for a couple more days before posting in ObEx.

[noparse][[/noparse]Edit] : Fixed copy-paste error in set4phase() method; converted demo program to menu-driven

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA

Post Edited (JonnyMac) : 5/11/2010 3:54:52 PM GMT

Comments

  • JonnyMacJonnyMac Posts: 9,208
    edited 2010-05-11 15:53
    Whoops... while making the code "prettier" I introduced a copy-paste error in the set4phase() method -- that's fixed now.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon McPhalen
    Hollywood, CA
  • Brian RileyBrian Riley Posts: 626
    edited 2010-05-14 02:12
    JOn,

    have you got MOuser and /or DigiKey partno's for suggested 2 lead and 3 lead bicolor LEDS?

    cheers ... BBR

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    cheers ... brian riley, n1bq, underhill center, vermont
    The Shoppe at Wulfden
    www.wulfden.org/TheShoppe/
    www.wulfden.org/TheShoppe/prop/ - Propeller Products
    www.wulfden.org/TheShoppe/k107/ - Serial LCD Display Gear
  • JonnyMacJonnyMac Posts: 9,208
    edited 2010-05-14 03:50
    The 3-lead version that I tend to use is: 78-TLUV5300. I have some 2-lead units, but don't know where I got them so I don't have a part #.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon McPhalen
    Hollywood, CA
  • Nick McClickNick McClick Posts: 1,003
    edited 2010-05-14 08:14
    Here's a 2-lead version on mouser. It's on B/O now, though.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Forums RSS Feed!

    Gadget Gangster - Share your Electronic Projects
  • train nuttrain nut Posts: 70
    edited 2010-05-14 15:35
    Anyone that's interested.· All Electronics at· allelectronics.com has a two lead bicolor led part no LED-6 for $0.50 each.



    Ben
  • JonnyMacJonnyMac Posts: 9,208
    edited 2010-05-14 16:04
    Thanks, Ben, I need to pop by there this weekend, anyway, so I will pick some up.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon McPhalen
    Hollywood, CA
Sign In or Register to comment.