PyRaspBeta

← All practice problems

Raspberry Pi practice problem · Projects

Bike light

EasyBudget $3Python · gpiozero

A bike light: a button on GPIO27 and a white LED on GPIO17. Each press moves to the next mode:

off → steady → flashing → off → …

Flashing is 0.25 s on, 0.25 s off. The light starts off; the test presses at 1 s, 3 s and 6 s.

Tip: gpiozero's LED.blink(on_time, off_time) flashes in the background.

More in Projects