Submit

08 / 20

Make a mood lamp

Mix three PWM channels inside a frosted globe.

Run this experiment →
ESP32 teaching illustration with module, GPIO headers and lesson components

Why it’s here

Create yellow with red and green, then try a cool blue.

How it works

Mix three PWM channels inside a frosted globe. The RGB package contains separate LEDs. Each color needs its own current-limiting path. This guided model targets the original ESP32 and Arduino-ESP32 3.x; radio, acoustics, loads and mechanics are simplified.

Try it

  1. Open this experiment
  2. Create yellow with red and green, then try a cool blue.

Connections

  • GPIO 25 / 26 / 27 — Red / green / blue through separate resistors
  • GND — Common cathode

Example sketch

// Common-cathode RGB LED. One resistor per color.

void setup() {
  ledcAttach(25, 5000, 8);
  ledcAttach(26, 5000, 8);
  ledcAttach(27, 5000, 8);
}

void loop() {
  ledcWrite(25, 180);
  ledcWrite(26, 90);
  ledcWrite(27, 220);
}

Check your understanding

Why does each channel need a resistor?

Show the answer

The RGB package contains separate LEDs. Each color needs its own current-limiting path.

Sources

Arduino-ESP32 ↗ · GPIO reference ↗

MAKE A THOUGHTFUL CHOICE

Your shortlist, side by side.

Pricing models are indicative. Check each official website for current plans and limits.