Raspberry Pi practice problem · Displays
Crossfade lamp
HardBudget $10Python · gpiozero
A NeoPixel stick (8 LEDs, DIN on GPIO18, 5 V) and a button on GPIO17 (to GND, pull-up). The colours are red (255, 0, 0) → green (0, 255, 0) → blue (0, 0, 255) → red… The whole stick starts red.
Each press fades linearly from the current colour to the next one over 2 s, updating at least 20 times a second, then holds it. Halfway through a fade from red to green the stick is about (128, 128, 0). Presses during a fade are ignored.
The test presses at 1 s, 4 s and 5.5 s (the last one during a fade).