An example showing latching & releasing.

Original Query

Show me the ladder logic (in JSON format) for a system that turn on an output (O1) when an input (I1) is pressed, then turn it back off when I1 is pressed again.

Resulting JSON

  {
  "rung": [
    {
      "input": [
        {"name": "I1", "type": "coil", "state": "on", "edge": "rising"}
      ],
      "output": {"name": "O1", "type": "latch", "state": "on"}
    },
    {
      "input": [
        {"name": "I1", "type": "coil", "state": "on", "edge": "rising"},
        {"name": "O1", "type": "coil", "state": "on"}
      ],
      "output": {"name": "O1", "type": "latch", "state": "off"}
    }
  ]
}