← All exercises

Hysteresis

medium

Applies hysteresis to an analog input, setting the output true at the high limit and false at the low limit.

What it teaches

Use two different thresholds — one to turn on, a lower one to turn off — so the output doesn't flicker when the input wobbles near a single value. Picture an air conditioner: it switches on at 20 °C and keeps cooling until the room falls back to 18 °C.

Inputs and outputs

TagTypeDefaultDescription
In_ValueREAL
Cfg_HighLimitREAL20
Cfg_LowLimitREAL18
Out_ActiveBOOL

Required behavior