866Views8Replies

Author Options:

How can I change the color of a RGB LED with the push of a button (i.e., push once for red, again for green, etc.). Answered

I have to laugh when I see the prices of flashlights that have multiple LED colors. $50 for a headlamp with 6 RGB LEDs?  Really?  I have seen "Buy It Now"s on eBay that have 50 pcs of RGB LEDs for ~$17.  Besides, the fun is in building one myself.

Tags:RGBLED

Discussions

You want to cycle through 3 colours with a single push button - some kind of microcontroller would be in order. Unless you can get a rotary switch that works on a push (like a ballpoint pen)?

L

I like that idea.  I have a flashlight that has that (off-LED-Laser).  What are they called.  I tried to find them online, but can't seem to find exactly that.  I would need one with an off and 4 "on".  I will be using RGB LEDs (3 in 1 package, shared anode), UV LEDs and a krypton bulb.

The push-rotary is simplest if you can find one, or maybe just a rotary. Otherwise it gets more complicated. I think of motorbike gears - one way up, the other down - click, click, click...

L

switching could be done with clever use of a 4 bit counter chip and a multiplexer

Hint: use the pushbutton as the clock source thru a Schmidtt trigger (to debounce clk> )

Are you comparing LEDs of the same specification. I can pick up 0605 (surface mount) RGB LEDS for your kind of prices, but they are slightly bigger than a grain of sugar.....

What you want to do is do-able with simple logic, but depends on the wiring of the LED. Are you going to use separate RGB elements, or are they arranged with common wires, or back-to-back ? 

Steve

0
None
Marsh

8 years ago

 This is how a DPDT switch would be used to accomplish the task.

012_01.gif

.  A DPDT switch or relay will swap polarity.