Multi-phase, bi-color LED control
JonnyMac
Posts: 9,208
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
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
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
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
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Forums RSS Feed!
Gadget Gangster - Share your Electronic Projects
Ben
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA