RGB LED Color Mixer
Mix three independently driven PWM channels in a common-cathode RGB LED.

Wire it up
Disconnect power before changing connections. Follow terminal names rather than wire colors.
| From | To | Why it matters |
|---|---|---|
| RGB LED (rgb1) · COM | Uno · GND.1 | Ground reference |
| Uno · 9 | Resistor (r0) · 1 | Match this terminal to the sketch |
| Resistor (r0) · 2 | RGB LED (rgb1) · R | Match this terminal to the sketch |
| Uno · 10 | Resistor (r1) · 1 | Match this terminal to the sketch |
| Resistor (r1) · 2 | RGB LED (rgb1) · G | Match this terminal to the sketch |
| Uno · 11 | Resistor (r2) · 1 | Match this terminal to the sketch |
| Resistor (r2) · 2 | RGB LED (rgb1) · B | Match this terminal to the sketch |
The complete sketch
void setup() {
pinMode(9, OUTPUT); pinMode(10, OUTPUT); pinMode(11, OUTPUT);
}
void loop() {
analogWrite(9, 128); // red
analogWrite(10, 64); // green
analogWrite(11, 192); // blue
}
The launch buttons use this same code and a matching saved circuit.
Build it step by step
Open a complete project
Launch in Simulator creates a separate Uno sketch and its matching wired circuit. Existing sketches are preserved. Press Run to compile and execute.
Explore the live circuit
Change one channel value, rerun, and compare the mixed color. Zero switches that channel off.
Try it on hardware
Disconnect power while wiring. Match terminal names in the table, select the exact board, Verify, then connect and upload. Check component ratings and power requirements first.
Understand the sketch
Three LEDs in one package
R, G, and B each need a current-limiting resistor. COM is connected to ground for this common-cathode project. A common-anode LED needs different wiring and inverted duty cycles.
If something is different
Unexpected colors
Use the named R/G/B/COM terminals. Physical lead order varies; check the exact LED pinout.
Expected output and tested scope
The red, green and blue PWM channels combine into changing modeled colors.
Version 1 · Last source- and build-matched test: 2026-10-25. Actual shipped AVR-GCC WASM compilation and Uno AVR engine execution; no physical hardware test.
Supported tutorial target: Arduino Uno R3 / ATmega328P. Compile: PASS · Modeled execution: PASS. Other boards require a separate review of pins, voltage, libraries and the exact build profile.