Raspberry Pi practice problem · Motors & actuators
Snooze
HardBudget $3Python · gpiozero
An alarm clock's beeper: an active buzzer on GPIO23 (pi.GPIO23 >> Buzzer() >> pi.GND; it may draw up to 25 mA) and a push button on GPIO27 (to ground, Pi pull-up).
- The alarm goes off at 1 s: beeps of 0.25 s on, 0.25 s off.
- Tap the button (release within 1 s) to snooze: silence at once, and the beeping starts again 3 s after the press.
- Hold the button for 1 s to switch the alarm off for good. The beeping stops as soon as the button is pressed, like a snooze.
The test taps at 2.1 s (beeping again from 5.1 s) and holds the button from 6.6 s to 7.8 s; after that it must stay silent.