Voting Lamp
easy
2-of-3 majority voting for a lamp output.
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.
Parameters
| Tag | Direction | Type | Default | Description |
|---|---|---|---|---|
| In_ButtonA | Input | BOOL | 0 | First push button |
| In_ButtonB | Input | BOOL | 0 | Second push button |
| In_ButtonC | Input | BOOL | 0 | Third push button |
| Out_Lamp | Output | BOOL | 0 | 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.