Go Down

Topic: LED COLORS (Read 768 times) previous topic - next topic


Hello everyone, i'm brand new to Arduino and i would llike to accomplish the following..

i would like to have a button that changes a led color everytime the button is changed (ie:)

pressed 1x = red
pressed again = green
pressed again = blue
pressed again = yellow
pressed again = purple
pressed again = orange

if pressed again = red (basically starting from the beginning).. how many colors are in an led (not talking about the single color led bulbs)..

i seen a tetris table on you tube that had all colors as well as a visualizer coffee table.. so, i want to know how to control colors.

thanks in advance,


Hi Ruffsta,

Have a look at this Instructable which looks like it will answer a lot of your questions.




Pick yourself up an  RGB LED do some playing.
Red, no green, no blue = Red
no red, Green, no blue = Green
no red, no green, Blue = Blue
all three = White
Red, no green, Blue  = Purple
Red, Green, no blue = Amber (sort of yellow)
Orange - Idon't know.
If you had PWM on each color, then you change the intensity of the mixed colors as well.
Say 75% red, 25% green, no blue = Orange(ish)?

So if you had an arduino, an RGB LED, 3 current limit resistors sized to not exceed the current capabiliy of  the 3 LEDs (since Red, Green, Blue typically have different forward voltages, different current limit resistors would be needed),
then connecting each to a PWM pin and using
analogWrite (RedLedPin, 196); // 0 min, 255 max
analogWrite (GreenLedPin, 64);
analogWrite (BlueLedPin, 0);
mighe yield orange for example.
Have to experiment some and see.

From there, you expand on the hardware for the size table you need, maybe with tons of chips (all LEDs capable of being driven all the time), maybe with multiplxing (one, or maybe a row or a column, are on at one time, but you switch between them all quickly to trick the eye into seeing them all as on, but maybe not quite as bright - but high brightness LEDs (blindingly bright even) can overcome that too).
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.


Colorpic is a useful tool to see what RGB mix you need to get what colour.


thank you very much guys.. (as for the color picker.. i code websites and already have one, but thanks tho).

i love the fast responses, i thought i was going to be waiting a few days for an answer.


i thought i was going to be waiting a few days for an answer.

The beauty of time zones on the Internet, is that there's always someone, somewhere reading the forum!

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131