Free
6 min

Beginner 08 — Delayed-on light (TON)

beginnerfundamentalstimerTON
Beginner 08 — Delayed-on light (TON) scenario preview

Ready to build this?

Sign up free — no credit card required. This scenario is included in the free tier.

Sign up to play this scenario →

Already have an account? Log in

Briefing

An on-delay timer: after SWITCH closes, wait 2 seconds, then turn LIGHT on. Release the switch early and the timer resets — the LIGHT never comes on. A TON ("Timer On-Delay") is a function block. You declare an instance in VAR, call it with an enable input and a preset time in milliseconds, then read its .Q output bit on a rung.

Objectives

  • Hold SWITCH on for less than 2 seconds → LIGHT stays off
  • Hold SWITCH on for at least 2 seconds → LIGHT turns on

Hints

  • Declare a timer instance in VAR: T_DELAY : TON;
  • Call it once each scan: T_DELAY(IN := SWITCH, PT := 2000);
  • Then read its done bit on its own rung: | T_DELAY.Q | := LIGHT ;

I/O Table

Inputs

SWITCH

Hold-to-arm switch (NO)

BOOL · %I0.0

Outputs

LIGHT

Indicator lamp

BOOL · %Q0.0

Your program will be tested against:

All test cases run automatically when you submit. Assertions are hidden until you pass.

  1. #1Hold SWITCH 2200 ms → LIGHT on

    Once the 2 s preset elapses, TON.Q goes true

  2. #2Hold SWITCH 500 ms → LIGHT stays off

    Timer has not yet reached its 2 s preset

  3. #3Release SWITCH early → LIGHT stays off

    Dropping IN before PT elapses resets the timer

Ready to build this?

Sign up free — no credit card required. This scenario is included in the free tier.

Sign up to play this scenario →

Already have an account? Log in