PyRaspBeta

← All practice problems

Raspberry Pi practice problem · Projects

Pomodoro timer

HardBudget $13Python · gpiozero

A desk focus timer, at demo speed: a TM1637 display (CLK GPIO23, DIO GPIO24), a button on GPIO26, a green work LED on GPIO17, a yellow break LED on GPIO27 and an active buzzer on GPIO25 (may draw up to 25 mA).

  • Idle: the display shows 0 (right-aligned) and both LEDs are off.
  • A press starts work: 8 s, green LED on, then a break: 4 s, yellow LED on, then back to idle.
  • The display shows the seconds left in the current part, rounded up (8 at the start of work, 1 during its last second).
  • At the end of work and at the end of the break, beep for 0.5 s. The break starts straight away, while the beep sounds.
  • A press during work or a break pauses the countdown (the display and LED stay as they are); the next press resumes it.

The test presses at 1 s (start), 3.5 s (pause) and 5.5 s (resume), so work ends at 11 s and the break at 15 s.

More in Projects