Back to Index

Definition: ton("id", cond, preset_ms [, retentive]) — Allowed: string literal id and numeric expressions; Not allowed: expression id.

On-delay timer: returns 1 only after cond has stayed true for preset_ms. When retentive is non-zero, elapsed time and DONE state persist while cond is false until t_reset("id") is called.

Example

// Require 3 seconds of continuous low input before alarm
if (ton("low_in", in(1) == 0, 3000)) {
  publish("plc/alarm", "low_input");
}