Hello i was wondering what is the codes to make a red white and blue as well as green with a rgb led but what i don't know also is what resistors to use because i know in the red green and blue all take different resistors what I'm using is 5v to power up the led off the arduino can someone please help me out?
Last time I tried a RGB LED, I used 3 resistors of same value, connect them to 3 analog outputs. Then to make a fully red color, you write 255 to the corresponding output. Same for blue... and for white you write 255 to all three outputs.
josephchrzempiec:
Hello i was wondering what is the codes to make a red white and blue as well as green with a rgb led but what i don't know also is what resistors to use because i know in the red green and blue all take different resistors what I'm using is 5v to power up the led off the arduino can someone please help me out?
Joseph
You can make all of the additive and subtractive primary colors with an RGB LED:
RED = RED GREEN = GREEN BLUE = BLUE CYAN = GREEN + BLUE (i.e. "Not Red") MAGENTA = RED + BLUE (i.e. "Not Green") YELLOW = RED + GREEN (i.e. "Not Blue") BLACK = ALL OFF WHITE = RED + GREEN + BLUE
If you look up or measure the forward voltages of the individual colour LEDs you can
work out the correct series resistance for a given current. For example if green
LED has about 3V forward resistance to get 20mA you would use (5.0 - 3.0) / 0.02 = 100
ohm. Assuming supply is 5.0V