← All exercises

Two-Button Lamp

easy

Turn on a lamp only when both push buttons are pressed at once.

What it teaches

Turn on the lamp only when both buttons are pressed at the same time. The 'two-hand safety' interlock on industrial presses uses the same idea.

Inputs and outputs

TagTypeDefaultDescription
In_Button1BOOLFirst push button
In_Button2BOOLSecond push button
Out_LampBOOLLamp drive signal

Required behavior

  • The Out_Lamp is active (1) when both In_Button1 and In_Button2 are active (1).
  • The Out_Lamp is inactive (0) when either In_Button1 or In_Button2 is inactive (0).