Skip to content
PLCampus
All examples

01Level 1

Turn on a lamp with a switch

The simplest program: one input and one output. Perfect for seeing power flow and the scan cycle for the first time.

The simulator is designed for computers (screens 1024 px or wider).

Virtual plant

Q0.0 · Lamp off

Lamp off

Shown at rest. In the simulator the plant moves according to your program's outputs.

Inputs and outputs

AddressNameDescription
I0.0SWITCHWall switch (maintained)
Q0.0LAMPCeiling lamp

Program

Ladder diagram (LD)

  1. Rung 1 — The lamp follows the switch.

    SWITCHI0.0LAMPQ0.0

Step by step

  1. 1Press ▶ Run (F5) to put the PLC in RUN.
  2. 2Flip switch I0.0 on the panel: the plant's lamp turns on and the rung turns green.
  3. 3Change the contact to a normally closed (NC) one in the properties panel: now the lamp is on while the switch is off.
  4. 4Open the “Scan cycle” tab and step through it to see when the output actually changes.