Raspberry Pi practice problem · Buttons & input
Binary tally
MediumBudget $6Python · gpiozero
A button on GPIO27 (to ground) and three LEDs showing a count in binary: GPIO17 = 1s bit, GPIO22 = 2s bit, GPIO23 = 4s bit.
The count starts at 0 (all off) and goes up by one per press, wrapping from 7 back to 0. The button bounces: one press must count once.
The test presses nine times, every 0.5 s from 1.0 s (so the count ends at 9 → 1).