Band 8 · Build for Nzemaland
Practice The pomodoro timer
Two states, one buzzer, and the habit that makes every slow device testable: build it in fast-forward, then change two numbers.
Sketches for this project
Every file opens with a plain-English header saying what it does and how to wire it, hole by hole.
A timer you would actually use
Twenty-five minutes of work, then five minutes of rest, then round again. A different sound at each change so you know which one just started, without looking.
One buzzer. That is the entire circuit, and everything hard about this is in the code.
This is the smallest state machine there is, and Band 8 is about state machines
Two states: working and resting. Nothing else. A device is in exactly one of them at any moment, and it moves between them for exactly one reason, which is that enough time has passed.
Band 8's tank alarm has four states and five ways to move between them: four presses that walk round the cycle, and one that fires on its own when the snooze runs out. Build this two-state one first and that one stops looking frightening.
The habit this page is really teaching
10 minYou cannot test this by waiting twenty-five minutes
If you did, one round of testing costs you half an hour, and you will need ten rounds. That is a lost day, and at the end of it you will still not have tested what happens after four cycles.
So put both times in named variables at the top, and set them to seconds while you build. Twenty-five seconds of work and five seconds of rest. Now a full cycle takes half a minute and you can test properly. When it is right, change two numbers and nothing else.
That is not a shortcut. It is how the thing is supposed to be written, and it is one of the most useful habits in this entire course. Every device that waits for something slow should be buildable in fast-forward, and if yours cannot be, the numbers are buried where they should not be.
Two more things to settle on paper before you write anything:
delayormillis? Adelayof twenty-five minutes works and does exactly one thing. Could you add a button that skips to the break? Answer that and you have chosen.- What does it do at the change? Two different sounds, and they have to be different enough to tell apart from the next room, which is where you will be.
Build it in fast-forward, then run it for real
30 mina. Count two wires on the rail before you start: the buzzer's, and one from that rail to a GND pin. Without the second one the rail is dead metal and the buzzer stays silent with nothing visibly wrong.A passive buzzer is better here, because it lets you make the two sounds properly different, and Band 5's bare wiring is right for it.
An active one works too, with one change: put a 220 ohm resistor in its pin leg, as Band 3 does. An active buzzer pulls about thirty thousandths of an amp and a pin is built for twenty. With one you can only vary how long the sound is, not what note it is, so make one change a single beep and the other three quick ones.
Build it with seconds, and watch five whole cycles. That is two and a half minutes of your life.
Now change the two numbers to twenty-five and five minutes, and use it for one real cycle. Actually work for the twenty-five. Actually stop for the five.
Two ways further
- Bronze
- Add a button that skips to the next state immediately. If you used
delay, you will now find out why this page asked you that question, and the honest answer is to rewrite it withmillis. - Silver
- Add a long break every fourth work session, which is what the real method says. That means a third state and something that counts, and it is genuinely a step up. Draw the three states and the arrows between them on paper before you write a line, exactly as Band 8 will make you.
Keep
- Your two named time variables, and the fact that you tested in seconds
- Your drawing of the states and the arrows, even for two states
- What you thought of it after one real cycle, written as complaints rather than praise
Those complaints are the most valuable thing on this page. A device you have used is a device you have opinions about, and Band 8 is entirely about getting those opinions from somebody who is not you.
Ship it
This one is yours. Nobody handed you a sketch for it, so the code in your video is code you wrote. Say that in the post, because it is the difference between somebody who can follow a tutorial and somebody who can build a thing, and it is the difference an employer is looking for.
The four shots as usual, and make the fourth one count: the check this page asked you to run, or the version that did not work first. Put a line of your own code on screen for three seconds. Almost nobody does, and it is the most convincing three seconds in the video.
Show your work has the template. Tag it #BozomaBuilds.