Raspberry Pi practice problem · LEDs & PWM
Scanner with a tail
HardBudget $8Python · gpiozero
Five PWM LEDs in a row, left to right: GPIO5, GPIO6, GPIO13, GPIO19, GPIO26.
A bright "head" bounces along the row, moving one place every 0.25 s: positions 0, 1, 2, 3, 4, 3, 2, 1, 0, 1, … (position 0 = GPIO5) starting at 0 s.
At every step:
- the head LED is at 100 %
- the LED the head just left is at 20 % (the tail — at the ends it is the LED the head bounced off)
- every other LED is off
At 0 s there is no tail yet: only GPIO5 is lit.