Voting Lamp
easy
Light a lamp when at least two of three push buttons are pressed.
What it teaches
Majority voting (2-of-3). The lamp turns on when any pair of buttons agrees — list the pairs that satisfy the vote and combine them with OR. Introduces n-of-m logic that recurs in safety and fault-tolerance patterns.
Inputs and outputs
| Tag | Type | Default | Description |
|---|---|---|---|
| In_ButtonA | BOOL | — | First push button |
| In_ButtonB | BOOL | — | Second push button |
| In_ButtonC | BOOL | — | Third push button |
| Out_Lamp | BOOL | — | Lamp drive signal |
Required behavior
- Out_Lamp is 1 when at least two of In_ButtonA, In_ButtonB, or In_ButtonC are 1.
- Out_Lamp is 0 when one or zero buttons are pressed.