Focus
A focus timer: the robot shows the time left as a ring and on its LEDs, chimes and nods when a phase ends; a tap starts it. The basics of an app.
i41-eu/q41eu-focus at v0.5.0 · focus.q41.eu
Two apps built on Dev's Go kit, as they are today: Focus, a focus timer, and Pet, a pet for kids. For each: what the robot and the phone show, how it is built, what it uses of the kit and of the robot, its key code with links to the exact lines, and what a developer learns from it.
A focus timer: the robot shows the time left as a ring and on its LEDs, chimes and nods when a phase ends; a tap starts it. The basics of an app.
i41-eu/q41eu-focus at v0.5.0 · focus.q41.eu
A Tamagotchi for kids: the pet lives on a server, the robot is its body. Menus, food cards, games, a daily routine. The rest of the robot.
i41-eu/q41eu-pet at v0.14.1 · pet.q41.eu
| Focus | Pet | |
|---|---|---|
| Code | 2,200 lines of Go and a 390-line page; 730 lines of tests | 6,900 lines of Go and 930 of pages; 2,400 lines of tests |
| Of the kit | robothub, sound | robothub, sound, leds |
| Of the robot | pictures on the screen, the LEDs, the speaker, the head; touches on the screen and the head | all that, and stored pictures and sounds (sprites, the file store), the speech bubble and the face, stickers, brightness and the screen saver, NFC cards, the motion sensors, the light sensor at 20 a second, the camera |
| Read it for | the kit's hub, a pure model with its tests, drawing the screen, sending only what changed, touches | meaning from raw input, pictures kept on the robot, menus from tappable sprites, timed steps, streams, guarding the head, falling back |
The rest of this site is about programs: a script, a page or an AI agent that uses the robot through Dev, with a key. Focus and Pet are apps: servers the robot connects to itself, as it connects to Dev. The robot runs one app at a time; its app switcher (the QR screen: Next, Connect) moves between them.
| A program, through Dev | An app, on the kit | |
|---|---|---|
| Talks to | Dev's API (HTTP /v1, MCP), with a key | the robot itself, over the device wire protocol (robothub) |
| Runs | when you start it | all the time, as a server |
| In | any language | Go (the kit) |
| Reaches | Dev's actions and events | every command, event, reading and stream of the robot |
| Its own page | no: Dev's | yes, paired by the robot's QR code |
Each case study maps what the app does to Dev's actions, so a program can do the same where Dev's API reaches.
The Go packages every app needs (pkg.go.dev), and who uses them today. Dev is built on all of them.
| Package | What it does | Used by |
|---|---|---|
robothub | the robot side of an app: tokens (the shared one, or a manager's per robot), one connection per robot, pairing codes, pings; the app gets callbacks (connected, events, telemetry, binary streams) and sends commands; Report tells the manager the paired browsers | Focus, Pet, Dev |
sound | 16 kHz sounds: tones, bells, glides, melodies, the named chimes (Focus's and Pet's among them), speaker messages, WAV files | Focus, Pet, Dev |
leds | the 12 LEDs in the robot's order: a bar, one colour, a screen colour corrected for the LEDs | Pet, Dev |
robot | higher-level calls on a connected robot: a card, a picture, say, a face, look, nod, LEDs, sounds paced for the speaker | Dev |
screen | 320×240 pictures: a card with text that fits itself, a question with buttons and its hit test, the Go fonts | Dev |
gesture | the robot's raw input as what a person did: a tap, a pat, a pet, a stroke, picked up, a tag | Dev |