Your code doesn't run top-to-bottom once — it runs again and again, on a fixed clock. Read the inputs, run the logic, write the outputs, repeat. Understand this loop and everything else clicks.
An NJ/NX controller runs your Primary Periodic Task on a fixed period (say 1 ms). Every period it does the same three things. Step through one cycle, or let it run.
Input image sensors
Output image actuators
The logic here: out[i] := in[i] — each lamp mirrors its sensor, but only the values captured at phase 1.
📸 Inputs are frozen for the whole scan. If a sensor flips during Execute, your code won't see it until the next cycle's refresh. That consistency is a feature — your logic reads one coherent snapshot, never a value mid-change.
🐶 The watchdog guards the clock. If your program ever takes longer than the task period to execute, the controller trips a watchdog fault. Task execution time must always fit inside the period — that's the budget you design to.
🔋 And after power-off? Normal variables reset to their initial values. Only variables you mark Retain keep their last value across a power cycle — the topic that opens the Variable Scope deep dive.
A sensor turns on during the Execute phase. When does your logic first react to it?