<h1 id="making-a-pomodoro-timer">Making a Pomodoro Timer</h1>
<h2 id="slacking-off-at-work">Slacking Off at work</h2>
<ul>
<li>I get distracted Easy</li>
<li>My mind drifts if I try to focus on a single task For more than
20-30 Minutes.</li>
<li>If I try to fight the urge to just keep working my productivity goes
way down.</li>
<li>I end up working for a bit, then slacking off for half an hour.</li>
<li>I can get more work done If I embrace my limitation and force myself
to take a break.</li>
</ul>
<h2 id="pomodoro-technique">Pomodoro Technique</h2>
<p>From Wikipedia <a
href="https://en.wikipedia.org/wiki/Pomodoro_Technique"
class="uri">https://en.wikipedia.org/wiki/Pomodoro_Technique</a></p>
<blockquote>
<p>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.</p>
</blockquote>
<h2 id="the-timer">The Timer</h2>
<ul>
<li>There are plenty of Pomodoro Apps I've tried using an app, but I
would often forget.</li>
<li>I wanted a physical device that was always on by desk and could grab
my attention.</li>
<li>I looked for a dedicated physical Pomodoro timer, but only found the
kitchen timers</li>
<li>I decided to make myself a timer using a Circuit Playground
Express</li>
</ul>
<h2 id="circuit-playground-express">Circuit Playground Express</h2>
<ul>
<li>In my past episode about using a Pi pico to type passwords I
mentioned I owned a playground express.</li>
<li>The playground express is a micro controller with a lot of built ins
<ul>
<li>2 buttons</li>
<li>10 multi color LED</li>
<li>...</li>
</ul></li>
<li>Runs circuit python with lots of libraries so it is easy to
program.</li>
</ul>
<h2 id="tdd">TDD</h2>
<ul>
<li>About once every other year I decided to start a project with as
much TDD as I can.</li>
<li>TDD Basics
<ul>
<li>Write a test <strong>BEFORE</strong> you write the code</li>
<li>Run the test - It will fail</li>
<li>Write the simplest code that will pass the test</li>
<li>Run the test and make sure it passes</li>
<li>Refactor/improve the code if needed.</li>
</ul></li>
<li>TDD advantages
<ul>
<li>Code is easy to separate into discrete functions</li>
<li>Parts of the code can be rewritten without affecting the rest</li>
<li>confidence in rewrites</li>
</ul></li>
</ul>
<h2 id="pomodoro.py">pomodoro.py</h2>
<ul>
<li>Circuit python looks for and runs a file named
<code>code.py</code></li>
<li>A lot of the circuit Python code has to be run on the micro
controller</li>
<li>My Developers workstation does not have the LED's or buttons</li>
<li>I split the some code into a separate file based on if it could run
in "regular" python.</li>
<li>I used TDD as much as possible to test the functions in
pomodoro.py</li>
</ul>
<h2 id="code.py">code.py</h2>
<pre class="py"><code>BREAK_MINUTES = 5
WORK_MINUTES = 25</code></pre>
<ul>
<li>Functions that require hardware</li>
<li>No tests.</li>
<li>counts down and changes color of led</li>
<li>minutes divided by number of LED</li>
</ul>
<h2 id="using-the-timer">Using the timer</h2>
<ul>
<li>Ready
<ul>
<li>Green Light next to button to start work Period</li>
<li>Blue Light next to button to start break Period</li>
</ul></li>
<li>Working
<ul>
<li>White Background</li>
<li>Green progress pixels</li>
</ul></li>
<li>Break
<ul>
<li>White Background</li>
<li>Blue progress pixels</li>
</ul></li>
<li>Button A
<ul>
<li>Start working</li>
</ul></li>
<li>Button B
<ul>
<li>Start Break</li>
</ul></li>
</ul>
<h2 id="links">Links</h2>
<ul>
<li><a href="https://gitlab.com/norrist/circuit_playground_pomodoro"
class="uri">https://gitlab.com/norrist/circuit_playground_pomodoro</a></li>
<li><a href="https://circuitpython.org/downloads"
class="uri">https://circuitpython.org/downloads</a></li>
<li><a
href="https://learn.adafruit.com/adafruit-circuit-playground-express/circuitpython-neopixel"
class="uri">https://learn.adafruit.com/adafruit-circuit-playground-express/circuitpython-neopixel</a></li>
</ul>
