Control Flow
if / else
Tests two values with a comparison operator and executes the matching branch.
Control
ifcounter>=1000
Variables
set to numbercounter=0
IO
LED toggleLED1 (green)
| Operator | Meaning |
|---|---|
eq | Equal |
neq | Not equal |
gt | Greater than |
lt | Less than |
gte | Greater than or equal |
lte | Less than or equal |
Either operand can be a variable or a constant.
if flag
Tests one of the 64 event flags and branches if it is set.
Control
if flagflag34modeconsume
Debug
log string"spike on CH1"
| Mode | Behaviour |
|---|---|
| peek (non-destructive) | Reads the flag; leaves it unchanged |
| consume | Reads the flag; clears it if set (atomic) |
Use consume when you want to handle each event exactly once.
Flag ranges:
| Range | Source |
|---|---|
| 1 – 32 | Free — set by user script or PC command |
| 33 – 64 | Auto-set by spike detection: channel N (0–31) → flag 33 + N |
repeat (for)
Loops a counter variable from 0 up to (but not including) a limit.
Control
repeatcounteriwhile <32
Acquisition
RMS getchi→rms_val
Useful for iterating over all channels to initialize or sample each one.
wait_ms
Pauses the current loop iteration for a fixed duration.
Control
wait100ms
note
wait_ms is a Loop-only block. It cannot be placed in Setup.
end iteration
Immediately jumps to the end of the current loop iteration — a way to early-exit the loop body.
Control
end iteration
Example — spike-triggered log
SETUP
Acquisition
acquisition start
LOOP ~1 kHz
Control
if flagflag33modeconsume
Acquisition
spike getch0→ ampamptsts
Debug
log variableamp
Flag 33 fires whenever a spike is detected on channel 0. consume mode ensures each spike is logged exactly once.