PinoutSearch

RGB LED

Three LEDs (red, green, blue) in one package — mix any color with PWM.

How it works

An RGB LED is a red, a green, and a blue LED built into a single package that share one common leg. Drive each color from a PWM pin and you can mix millions of colors with analogWrite.

There are two types. Common-cathode: the shared leg goes to GND and you drive each color pin HIGH to light it. Common-anode: the shared leg goes to +5V and you drive each color LOW (inverted). Each of the three color legs still needs its own resistor.

Pins

R
Red — to a PWM pin through a resistor.
G
Green — to a PWM pin through a resistor.
B
Blue — to a PWM pin through a resistor.
Common
Longest leg — to GND (common-cathode) or +5V (common-anode).

Ratings

Type
Common-cathode or common-anode
Current
~20 mA per color (one resistor each)

Tips

  • Find out if yours is common-cathode or common-anode — it flips the wiring and code.
  • Use three PWM pins (~) so you can mix colors with analogWrite.