PyRaspBeta

← All practice problems

Raspberry Pi practice problem · LEDs & PWM

Two rhythms

EasyBudget $4Python · gpiozero

Two LEDs, each with its own rhythm:

  • a red LED on GPIO17 blinks 0.5 s on, 0.5 s off
  • a green LED on GPIO27 blinks 0.2 s on, 0.2 s off

Both run at the same time, forever.

Tip: gpiozero's blink() runs in the background, so you can start one blink and then the other.

More in LEDs & PWM