An example showing on-delay timers.

Original Query

Show me the ladder logic (in JSON format) for a system that will alert if Input 1 is held down for more than 15 seconds, or alert in 10 seconds if both Input 1 and Input 2 are closed.

Resulting JSON

  {
  "rung": [
    {
      "input": [
        {"name": "Input 1", "type": "coil", "state": "on"}
      ],
      "timer": {
        "name": "Timer 1",
        "type": "on-delay",
        "duration": 15,
        "units": "seconds"
      }
    },
    {
      "input": [
        {"name": "Timer 1", "type": "timer", "state": "done"}
      ],
      "output": {"name": "Alert", "type": "coil", "state": "on"}
    },
    {
      "input": [
        {"name": "Input 1", "type": "coil", "state": "on"},
        {"name": "Input 2", "type": "coil", "state": "on"}
      ],
      "timer": {
        "name": "Timer 2",
        "type": "on-delay",
        "duration": 10,
        "units": "seconds"
      }
    },
    {
      "input": [
        {"name": "Timer 2", "type": "timer", "state": "done"}
      ],
      "output": {"name": "Alert", "type": "coil", "state": "on"}
    }
  ]
}