Connect a Light Switch to a Light

This example connects a light switch to a light. Turning the switch on turns the light on; turning the switch off turns the light off again.

Required blocks

  • A device block for the light switch with a Boolean state output
  • A device block for the light with a Boolean on/off input

The available device blocks depend on the installed extensions and connected devices.

Program flow

Light switch: State → Light: On/Off

Configuration

  1. Add the light switch device block to the workspace.
  2. Add the light device block.
  3. Connect the Boolean state output of the light switch to the on/off input of the light.
  4. Validate and start the program.
  5. Operate the light switch and check that the light adopts the same state.

Result

The state of the light switch is passed directly to the light:

Light switchLight
Off (false)Off
On (true)On

Troubleshooting

  • Check that both devices are online and available in the Program Editor.
  • Make sure that a Boolean output is connected to a Boolean input.
  • After making changes, check that the program has been validated and started again.