PyRaspBeta

← All practice problems

Raspberry Pi practice problem · Buttons & input

Shutter release

EasyBudget $3Python · gpiozero

Some buttons act on release: a camera shutter, or a key that should do nothing if you change your mind… you can't, but you get the idea.

A button on GPIO27 (to ground) and an LED on GPIO17. When the button is released, flash the LED for 0.5 s. Nothing happens while it is held down.

The test holds the button from 1.0 s to 2.0 s, then taps it from 3.0 s to 3.2 s.

More in Buttons & input