A live language for microcontrollers

Talk to your board.
Watch it answer.

Writing Frothy is like having a conversation with your device. Ask it to do something, and it replies immediately. Change your mind, and try again. No compiling, no uploading, no black box.

redefine while it runs read back everything runs on ESP32 and RP2040
blink.fr
New here?

What is frothy programming?

Normally, programming a microcontroller goes like this: you write code on your computer, compile it, upload it to the board, and hope. Once it's on there, the board is a sealed box — you can't ask it what it's doing.

Frothy flips that around. The board itself understands the language, so you just talk to it. Type led.on: and the light comes on. Type a new version of a word and it takes effect instantly.

It feels like p5.js — but the canvas is a real circuit.

Frothy Badge · online
A Frothy badge — a keychain-sized dev board — held between two fingers, its dot-matrix screen lit up
The big idea

Three things that make Frothy feel different.

Live

Change it
while it runs.

Redefine a word and every place that uses it picks up the new version on the spot. No build step, no re-upload — the device never stops to listen.

to blink-led with n [
  repeat n [
    led.toggle:; wait: 90
  ]
]
blink-led: 3

…then change 90 to 30 and run again. Instantly faster.

Transparent

Nothing is
hidden from you.

Ask the device words and it lists everything it knows. Ask it to see any one and it hands back the source — even on a board that was never yours.

frothy> words
led.on  led.off  blink
frothy> see blink
to blink with pin, count, delay [ ... ]

The whole device, readable, out in the open.

Readable

Read it, and
you can write it.

Name a word with to, say what it takes with, and put the steps in brackets. Drastically simpler than C, and friendly to beginners.

to pulse with pin, delay [
  gpio.high: pin;
  wait: delay;
  gpio.low: pin
]

No headers, no build flags, no datasheet to read first.

See inside

The whole device, out in the open.

frothy connect
frothy> words                       -- ask what it knows
led.on  led.off  led.toggle  blink
adc.read  wait  millis  boot  ...
ok
frothy> see led.toggle              -- read any word's source
to led.toggle [ gpio.toggle: $led_builtin ]
ok
frothy> beat is fn [ led.toggle: ]  -- teach it a new word
ok
frothy> save                        -- snapshot it to flash
ok
frothy> restore                     -- revert to the last save
ok
words
Ask what it knows
Lists every word currently on the device, by name. Nothing is hidden in a binary you can't read.
see led.toggle
Read it back
Prints any word's definition the way the device stored it — even one you've never seen before.
save · restore
Keep it, or take it back
save writes your overlay to flash; restore brings the saved one back; dangerous.wipe clears it to the bare base.
A look at the language

Nine small programs.

scale.fr
to scale with percent, max [
  here bounded is clamp: percent, 0, 100;
  bounded * max / 100
]

scale: 80, 255
notes

A word is a name with code behind it — write it with to, run it with a trailing colon. with names its arguments.

here binds a value that's local to the block, so bounded exists only inside scale. A block hands back its last line — here, the scaled number.

On real hardware

Built for the messy middle.

An ESP32 development board on a workbench

Start with an ESP32 or RP2040 board.

Frothy is early, but the basic loop is already useful: flash a board, keep it powered, ask pins what they read, and redefine small words until the circuit starts making sense.

USB serial LED first ESP32 and RP2040

Change one fact at a time.

The hard part of a physical build is the messy middle — the wiring is half-right, the timing is off, and you're not sure what the sensor even returns. Frothy is good there. Leave the board powered and change it a word at a time.

  1. 01 Flash a board and open the prompt
  2. 02 Ask a pin what it reads, right now
  3. 03 Redefine a word; watch behavior change
  4. 04 save what works, and keep going
Get started

From a board to a live prompt.

You install nothing on your computer. The browser flasher puts Frothy on the board, and the browser editor talks to the board over USB.

  • Desktop Chrome, Edge, or Opera on macOS, Linux, or Windows. Safari and Firefox do not support Web Serial.
  • An ESP32 or RP2040 board and a USB data cable. See the boards.
  • A terminal is optional: Homebrew installs the Frothy CLI.
terminal (optional)
$ brew install nikokozak/frothy/frothy
$ frothy doctor        # check the board
$ frothy flash esp32_devkit_v1
$ frothy connect       # open the prompt
browser first · pre-alpha