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:
| time | lit |
|---|---|
| 0–0.5 s | none |
| 0.5–1.0 s | GPIO5 |
| 1.0–1.5 s | GPIO5, GPIO6 |
| 1.5–2.0 s | GPIO5, GPIO6, GPIO13 |
| 2.0–2.5 s | all 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.