Skip to content

2 · First light

A show answers five questions, in this order:

Section Question Think of it as
devices What hardware is wired up? the nouns
vars What live values do I track? the memory
inputs What can the user do? the buttons
scripts What can happen? the verbs
states When X happens, do Y the brain

This part uses three of them. Here is where you are going:

Live Eight pixels, breathing orange. Nothing to press yet.

Open the Studio and choose Project ▾ ▸ New project. Everything below is clicking.

Open SETUP, then Devices. Type barrel into the + new device box and press Enter. A card appears with sensible defaults; change them to match:

A device card in the Studio named barrel, with kind set to ledstrip, pin 16, count 8, order GRB, brightness 160, and a segments sub-panel with an 'add segment' button.
kind · pin · count · order · brightness. Two dropdowns and three number boxes.
  • kind ledstrip — a dropdown of every device kind the engine has.
  • pin 16, count 8 — one GPIO, eight pixels.
  • order GRB — the byte order your LEDs expect. Getting this wrong is the classic first-prop bug: red comes out green.
  • brightness 160 — the strip master, 0–255.

The name matters more than any of it. pin is stated once, here, and never mentioned again — everywhere else in the show those eight pixels are @barrel. Move the strip to a different GPIO and this box is the only thing that changes.

Open BEHAVIORS ▸ Scripts. Type idle into + new script.

The card that appears has an empty list at the bottom. Put a blink in it, either way you like:

  • drag the blink chip from the palette’s Strip group onto the list, or
  • click + effect under the list and pick blink.
A script card named idle in the Studio, containing one step row: a verb dropdown set to blink, a device dropdown set to @barrel, a colour swatch showing #ff6a00, sec 1.4, duty, an off colour of #140400, a flow dropdown set to serial, a ticked loop checkbox, speed and intensity boxes, and an expanded timing/conditions fold showing an off-color row.
One step. Every value on the row is a dropdown, a colour well or a number box.

Now fill the row in:

Control Set it to Why
device @barrel a dropdown of the devices you declared
colour #ff6a00 click the swatch for a colour picker
sec 1.4 seconds, everywhere in RFX — never milliseconds
loop ticked repeat until something stops it
+ timing / condition ▸ off-color #140400 what it shows on the off beat

off is not on the row by default because most verbs do not have one. The + timing / condition picker at the bottom of the step adds optional parameters one at a time, each as a plain-English row, instead of confronting you with a wall of empty boxes.

Open States. Type Ready into + new state. It becomes the initial state automatically — the make initial checkbox at the top of the card is already ticked, because it is the only state there is.

Under on enter, click + action and pick start, then choose idle from its script dropdown.

That is the show. The barrel is breathing.

Switch to the Show tab to see it. This is the whole file:

step-02-first-light.json 34 lines
{
  // ===========================================================
  //  BLASTER · STEP 2 — First light
  //  The smallest show that does something: one device, one
  //  verb, one state. Nothing else is required.
  // ===========================================================
  "schemaVersion": 1,
  "name": "Blaster 02 - First Light",
  "board": "t-display-s3",

  // THE NOUNS. Eight pixels down the barrel, on GPIO16.
  // Everywhere else in the file they are called @barrel.
  "devices": {
    "barrel": { "kind": "ledstrip", "count": 8, "pin": 16, "order": "GRB", "brightness": 160 }
  },

  // THE VERBS. A script is a container of things that happen.
  // `blink` alternates two colours on a 1.4 s cycle; `loop`
  // makes it repeat until something stops it.
  "scripts": {
    "idle": {
      "children": [
        { "blink": "@barrel", "color": "#ff6a00", "off": "#140400", "sec": 1.4, "loop": true }
      ]
    }
  },

  // THE BRAIN. One state, and entering it starts the idle look.
  "states": {
    "initial": "Ready",
    "Ready": { "enter": [ { "start": "idle" } ] }
  }
}

Worth noticing, now that you can compare the two views:

  • The cards are the JSON. devices ▸ barrel is the card you filled in; the step row is the object inside children; "loop": true is the checkbox.
  • The first key of a child is the verb. { "blink": "@barrel", … } — the verb and the thing it acts on, then its parameters.
  • A key you left alone is not written. You never saw flow because it was serial, the default, and the file does not carry it either. The editor writes the smallest file that means what you clicked.
  • The comments are real. Anything typed into a ▸ // notes fold is a // comment in this file, and it survives every later edit.
The Studio Show tab displaying the first-light show as syntax-highlighted JSON text.
The Show tab. `Show ▾ ▸ Pretty` re-indents it; Ctrl+S saves.
  • sec is seconds. Not milliseconds. The only thing that is not seconds is rate, which is units per second, and brightness, which is 0–255.
  • Colour can be an expression. The swatch writes #ff6a00, but the same box accepts hsv(time*0.1, 1, 1) and re-evaluates it every frame. Part 5 is all expressions.
  • board is checked, not obeyed. It is what lets the Studio tell you GPIO16 exists and nothing else has claimed it. Pick the wrong board and you get warnings, not crashes.

Next: 3 · The trigger — a button, and somewhere for the state machine to go.