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:
Open the Studio and choose Project ▾ ▸ New project.
Everything below is clicking.
1 · Declare the hardware
Section titled “1 · Declare the hardware”Open SETUP, then Devices. Type barrel into the + new device box
and press Enter. A card appears with sensible defaults; change them to match:
- kind
ledstrip— a dropdown of every device kind the engine has. - pin
16, count8— 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.
2 · Make something happen
Section titled “2 · Make something happen”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
blinkchip from the palette’s Strip group onto the list, or - click
+ effectunder the list and pickblink.
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.
3 · Say when
Section titled “3 · Say when”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.
What the editor wrote
Section titled “What the editor wrote”Switch to the Show tab to see it. This is the whole file:
{
// ===========================================================
// 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▸barrelis the card you filled in; the step row is the object insidechildren;"loop": trueis 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
flowbecause it wasserial, 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
▸ // notesfold is a//comment in this file, and it survives every later edit.
Three things that will bite you
Section titled “Three things that will bite you”secis seconds. Not milliseconds. The only thing that is not seconds israte, which is units per second, andbrightness, which is 0–255.- Colour can be an expression. The swatch writes
#ff6a00, but the same box acceptshsv(time*0.1, 1, 1)and re-evaluates it every frame. Part 5 is all expressions. boardis 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.