Capability

Live project UI

A script can declare live controls that appear in the browser UI view. This turns a physical prototype into something you can tune, trigger, and observe without rewriting code for every test.

Live Control Loop

01

Controls come from the sketch

The script declares controls with calls such as `uiSlider()` and `uiButton()`. The browser shows those controls, sends user changes back as events, and receives live value updates from the running object.

Minimal Pattern

Rebuild the UI when the browser says hello again, so a refreshed page or shared UI link knows which controls exist.

var brightness = 80;

function buildUi() {
  uiBegin();
  uiSlider("brightness", "Brightness", 0, 255, brightness);
  uiButton("flash", "Flash");
}

function setup() {
  buildUi();
}

function loop() {
  uiPoll();
  if (uiEventIs("hello")) buildUi();
  if (uiChanged("brightness")) brightness = uiGet("brightness");
  if (uiEventIs("press", "flash")) println("flash");
  delay(20);
}

Related Reference