PyRaspBeta

← All practice problems

Raspberry Pi practice problem · Displays

Parking meter

HardBudget $15Python · gpiozero

A parking meter: a TM1637 display (CLK GPIO23, DIO GPIO24, 3.3 V), a NeoPixel stick (DIN GPIO18, 5 V) and a coin button on GPIO17 (to GND, pull-up).

  • each coin adds 5 s of credit, up to a maximum of 20 s (extra credit is lost)
  • credit counts down continuously. While there is credit, show the remaining seconds rounded up, right-aligned (4.2 s left shows 5), and light the whole stick green (0, 255, 0)
  • with no credit, show ---- and light the whole stick red (255, 0, 0) — this is also how it starts
  • update at least 10 times a second

The test inserts a coin at 1 s, then five quick coins at 8, 8.5, 9, 9.5 and 10 s.

More in Displays