PyRaspBeta

← All practice problems

Raspberry Pi practice problem · LEDs & PWM

Mixing colours

EasyBudget $5Python · gpiozero

Two primaries make a secondary colour. An RGB LED (common cathode) has red on GPIO17, green on GPIO27 and blue on GPIO22, each with its own resistor. Show:

  1. yellow (red + green) from 0 to 1 s
  2. cyan (green + blue) from 1 to 2 s
  3. magenta (red + blue) from 2 to 3 s
  4. repeat

Each colour uses its two channels fully on and the third off.

More in LEDs & PWM