Learning Objectives
- Understand RGB color theory and additive color mixing
- Learn the difference between Common Cathode and Common Anode RGB LEDs
- Master PWM (Pulse Width Modulation) for brightness control
- Calculate proper resistor values for each LED color
- Create colorful projects with smooth transitions
What is an RGB LED?
An RGB LED is actually three LEDs in one package - a Red, Green, and Blue LED combined together. By mixing these three primary colors of light at different intensities, we can create virtually any color!
Additive Color Mixing
Unlike paint (subtractive mixing), light uses additive mixing:
- Red + Green = Yellow
- Green + Blue = Cyan
- Red + Blue = Magenta
- Red + Green + Blue = White
Interactive visualization — available in the full lesson
Common Cathode RGB LED
Common Cathode (CC) means all three LED cathodes (negative legs) are connected together internally and share one pin that goes to GND.
| Pin | Connection | Control |
|---|---|---|
| Red Anode | Through resistor to PWM pin | HIGH = ON |
| Green Anode | Through resistor to PWM pin | HIGH = ON |
| Blue Anode | Through resistor to PWM pin | HIGH = ON |
| Common Cathode | Directly to GND | Always GND |
Logic: analogWrite(pin, 255) = Full brightness, analogWrite(pin, 0) = OFF
Common Anode RGB LED
Common Anode (CA) means all three LED anodes (positive legs) are connected together internally and share one pin that goes to 5V.
| Pin | Connection | Control |
|---|---|---|
| Red Cathode | Through resistor to PWM pin | LOW = ON |
| Green Cathode | Through resistor to PWM pin | LOW = ON |
| Blue Cathode | Through resistor to PWM pin | LOW = ON |
| Common Anode | Directly to 5V | Always 5V |
Logic: analogWrite(pin, 0) = Full brightness, analogWrite(pin, 255) = OFF (inverted!)