PyRaspBeta

← All practice problems

Raspberry Pi practice problem · Projects

Turn signals

MediumBudget $5Python · gpiozero

Indicators for a bike helmet: a left button on GPIO5 and a right button on GPIO6; a yellow LED for each side, left on GPIO17, right on GPIO27.

  • Pressing a side's button starts that side flashing, 0.4 s on, 0.4 s off, and stops the other side.
  • Pressing the button of the side that is already flashing cancels it (both dark).

Both start dark. The test presses left at 1 s, right at 4 s and right again at 7 s.

More in Projects