Frothy is device-first. The host tools help you reach the board, but the board is the real environment.
Start with the small surface: led.*, gpio.*, adc.read, wait, and
millis. Reach for I2C, UART, or PWM only when your circuit needs them.
Board Identifiers
Frothy supports these official board identifiers:
esp32_devkit_v1
seeed_xiao_esp32s3
seeed_xiao_esp32c6
arduino_nano_rp2040_connect
seeed_xiao_rp2040
Choose the identifier that matches the board.
LED
led.on:
wait: 100
led.off:
The base library defines those helpers over the board pin and its active level:
to led.on [ gpio.write: $led_builtin, $led_active_level ]
to led.off [ gpio.write: $led_builtin, 1 - $led_active_level ]
GPIO
gpio.mode: $led_builtin, 1
gpio.write: $led_builtin, 1
wait: 100
gpio.write: $led_builtin, 0
Digital input:
gpio.mode: $boot_button, 0
gpio.read: $boot_button
Many board buttons are active-low: pressed reads 0, released reads 1. Name that once in your own code instead of remembering it everywhere.
ADC
adc.read: $a0
Treat raw ADC values as something you calibrate. Read a few values, move the sensor or knob, and decide what range matters for your circuit.
Events And Interrupts
Use Events for timers, GPIO edges, and Wi-Fi lifecycle changes that should keep running after the prompt returns. GPIO edge candidates may begin in an interrupt, but Frothy dispatches the registered body later at a safe point. Use Ctrl-C when you instead need to interrupt foreground evaluation.
Wi-Fi, HTTP, And TCP
Store credentials once, connect, and test readiness:
wifi.save: "network-name", "network-password"
wifi.connect:
wifi.ready?:
Use http.get and http.post for bounded one-shot responses. Both return
transient Bytes. TCP uses live handles for client streams and listeners.
To serve a page without an existing network, host one and open port 80:
wifi.host: "frothy", ""
wifi.ip:
server is tcp.listen: 80
The bundled examples/14-captive-portal.fr example adds a debounced button
that toggles the LED. The Wi-Fi, HTTP & TCP guide
shows the complete serving loop and the browser-request rules.
Bluetooth Low Energy
BLE-enabled firmware can scan, advertise, connect, and act as either side of a small GATT conversation:
ble.on:
ble.info:
Bluetooth is capability-gated, so check for ble.on in words. The
Bluetooth Low Energy guide
covers central and
peripheral roles, raw diagnostics, queues, handles, and current limits.
The Rest Of The Board Surface
- I2C — sensors, raw transfers, and register helpers
- UART — auxiliary serial byte streams
- PWM — periodic output and duty control
- Digital signals — edge capture and finite pulse output
- Power — watchdog supervision and deep sleep
- Console routing — move and recover the human REPL
- Math & random — bounded integer helpers
The Modules guide is the complete feature map and links each area to its exact word-catalog entries.
Next: Snapshots and persistence .