PyRaspBeta

← All practice problems

Raspberry Pi practice problem · LEDs & PWM

Common anode

EasyBudget $5Python · gpiozero

Many RGB LEDs are common anode: the shared leg goes to 3.3 V and each colour lights when its pin is pulled low.

Buy RGBLED("anode"), connect its common leg to 3.3 V, and wire red to GPIO17, green to GPIO27, blue to GPIO22, each through its own resistor. Then show:

  • blue from 0 to 2 s
  • green from 2 s on, for good

Drive the pins as plain on/off outputs (no PWM) — full colours don't need it.

Tip: RGBLED(17, 27, 22, active_high=False, pwm=False).

More in LEDs & PWM