Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes Monday through Friday.


HPR4075: Making a Pomodoro Timer

Hosted by norrist on 2024-03-15 00:00:00
Download or Listen

Making a Pomodoro Timer

Slacking Off at work

  • I get distracted Easy
  • My mind drifts if I try to focus on a single task For more than 20-30 Minutes.
  • If I try to fight the urge to just keep working my productivity goes way down.
  • I end up working for a bit, then slacking off for half an hour.
  • I can get more work done If I embrace my limitation and force myself to take a break.

Pomodoro Technique

From Wikipedia https://en.wikipedia.org/wiki/Pomodoro_Technique

The Pomodoro Technique is a time management method developed by Francesco Cirillo in the late 1980s. It uses a kitchen timer to break work into intervals, typically 25 minutes in length, separated by short breaks. Each interval is known as a Pomodoro, from the Italian word for tomato, after the tomato-shaped kitchen timer Cirillo used as a university student.

The Timer

  • There are plenty of Pomodoro Apps I've tried using an app, but I would often forget.
  • I wanted a physical device that was always on by desk and could grab my attention.
  • I looked for a dedicated physical Pomodoro timer, but only found the kitchen timers
  • I decided to make myself a timer using a Circuit Playground Express

Circuit Playground Express

  • In my past episode about using a Pi pico to type passwords I mentioned I owned a playground express.
  • The playground express is a micro controller with a lot of built ins
    • 2 buttons
    • 10 multi color LED
    • ...
  • Runs circuit python with lots of libraries so it is easy to program.

TDD

  • About once every other year I decided to start a project with as much TDD as I can.
  • TDD Basics
    • Write a test BEFORE you write the code
    • Run the test - It will fail
    • Write the simplest code that will pass the test
    • Run the test and make sure it passes
    • Refactor/improve the code if needed.
  • TDD advantages
    • Code is easy to separate into discrete functions
    • Parts of the code can be rewritten without affecting the rest
    • confidence in rewrites

pomodoro.py

  • Circuit python looks for and runs a file named code.py
  • A lot of the circuit Python code has to be run on the micro controller
  • My Developers workstation does not have the LED's or buttons
  • I split the some code into a separate file based on if it could run in "regular" python.
  • I used TDD as much as possible to test the functions in pomodoro.py

code.py

BREAK_MINUTES = 5
WORK_MINUTES = 25
  • Functions that require hardware
  • No tests.
  • counts down and changes color of led
  • minutes divided by number of LED

Using the timer

  • Ready
    • Green Light next to button to start work Period
    • Blue Light next to button to start break Period
  • Working
    • White Background
    • Green progress pixels
  • Break
    • White Background
    • Blue progress pixels
  • Button A
    • Start working
  • Button B
    • Start Break

Comments


operat0r says: ADD

RE: hpr4075::2024-03-15 Making a Pomodoro Timer by norrist
00:19:50 Listen in ogg, spx, or mp3 format.
You got ADD brah...

https://rmccurdy.com/stuff/.tmp_tmp/_ADHD/Autism+Spectrum.png


More Information...


Copyright Information

Unless otherwise stated, our shows are released under a Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) license.

The HPR Website Design is released to the Public Domain.