Raspberry Pi practice problem · Buttons & input
Shift and Caps Lock
MediumBudget $3Python · gpiozero
Two buttons (both to ground): Shift on GPIO5 and a letter key on GPIO6.
- pressing the letter key prints
a, orAwhen it should be upper case - holding Shift while pressing the letter key flips the case
- tapping Shift on its own (pressed and released with no letter key in between) toggles Caps Lock, printing
Caps onorCaps off; Caps Lock flips the case too, so Caps Lock plus Shift givesa
The test, in order: letter at 1.0 s; Shift held 2.0–3.0 s with the letter at 2.4 s; Shift tapped at 3.5 s; letter at 4.2 s; Shift held 4.8–5.8 s with the letter at 5.2 s; Shift tapped at 6.3 s; letter at 7.0 s.