PyRaspBeta

← All practice problems

Raspberry Pi practice problem · LEDs & PWM

Filling up

EasyBudget $7Python · gpiozero

Four LEDs in a column, bottom to top: GPIO5, GPIO6, GPIO13, GPIO19. Fill the column, then empty it:

timelit
0–0.5 snone
0.5–1.0 sGPIO5
1.0–1.5 sGPIO5, GPIO6
1.5–2.0 sGPIO5, GPIO6, GPIO13
2.0–2.5 sall four

Then start again at 2.5 s (all off), and so on.

Tip: LEDBarGraph(5, 6, 13, 19) lights the right number of LEDs for a value from 0 to 1.

More in LEDs & PWM