← All exercises

Either-Button Lamp

easy

Turn on a lamp when either push button is pressed and off when both are released.

What it teaches

Turn on the lamp when at least one button is pressed. A doorbell wired to multiple buttons has the same shape.

Inputs and outputs

TagTypeDefaultDescription
In_Button1BOOLFirst push button
In_Button2BOOLSecond push button
Out_LampBOOLLamp drive signal

Required behavior

  • Out_Lamp is 1 when either In_Button1 or In_Button2 is 1.
  • Out_Lamp is 0 when both In_Button1 and In_Button2 are 0.