Skip to main content

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)
OperatorMeaning
eqEqual
neqNot equal
gtGreater than
ltLess than
gteGreater than or equal
lteLess 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"
ModeBehaviour
peek (non-destructive)Reads the flag; leaves it unchanged
consumeReads the flag; clears it if set (atomic)

Use consume when you want to handle each event exactly once.

Flag ranges:

RangeSource
1 – 32Free — set by user script or PC command
33 – 64Auto-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.