Board Constants & Helpers

The named pins, literals, GPIO helpers, LED helpers, and small source library installed at boot.


Every firmware image starts with core words, target-native words, board constants, and a small Frothy source library. This page is the map of that ready-to-use layer.

First Example

gpio.output: $led_builtin
led.blink: 3, 75
adc.percent: $a0

The constants let the same source describe intent without copying pin numbers. The helpers are ordinary Frothy words layered over the raw native surface.

Board Constants

NameMeaning
$led_builtinBuilt-in LED pin
$led_active_levelElectrical level that turns the built-in LED on
$boot_buttonBoard boot-button pin
$a0Default analog input
$sdaDefault I2C data pin
$sclDefault I2C clock pin

The two supported ESP32 board definitions install the same names but may bind them to different pin numbers or LED polarity. Use the names unless the circuit requires a specific pin.

GPIO Helpers

The raw primitives are gpio.mode, gpio.write, and gpio.read. The source library adds intent-revealing wrappers:

gpio.output: 4
gpio.high: 4
gpio.toggle: 4
gpio.low: 4
gpio.input: 4

pin is an alias for gpio.write.

Built-In LED Helpers

The LED helpers account for the board’s active level:

led.on:
led.toggle:
led.off:
led.blink: 3, 75

Use blink: pin, count, wait_ms when you want the same behavior on another pin.

ADC, Math, And Random Helpers

The source library also installs:

These definitions live in the base image and can be inspected on the device:

see led.blink
see adc.percent

Go to GPIO & ADC for the electrical I/O contract or the word catalog for every exact signature.