PyRaspBeta

← All practice problems

Raspberry Pi practice problem · Projects

Take a number

MediumBudget $8Python · gpiozero

The ticket machine at a deli counter: a ticket button on GPIO27 for customers, a next button on GPIO22 for staff, and a TM1637 display (CLK GPIO23, DIO GPIO24) showing the number now serving, right-aligned.

  • Each ticket press prints Ticket N (1, 2, 3, …).
  • Each next press advances "now serving" by one — but never past the last ticket handed out.
  • The display starts at 0.

The test takes three tickets (1 s, 1.5 s, 2 s) and presses next four times (3 s, 4 s, 5 s, 6 s).

More in Projects