← All exercises

One-Scan Delay

medium

Drives one output that follows the button instantly and another that follows it one scan later.

What it teaches

Both lamps watch the same button: one follows it immediately, the other follows one scan later. The delay isn't a timer — it comes from order. Your program runs top to bottom every scan, so if you copy a value before the line that updates it, you copy last scan's value and end up one scan behind. That "use last scan's value" idea is the heart of edge detection, and it is why logic that looks correct can still switch a scan too early or too late.

Inputs and outputs

TagTypeDefaultDescription
In_ButtonBOOL
Out_NowBOOL
Out_DelayedBOOL

Required behavior