← All exercises

Press-Toggle Lamp

easy

Flip the lamp state on each rising edge of the push button.

What it teaches

Each press flips the lamp: off → on → off → on. Holding the button doesn't keep flipping — only the moment of press counts. The basic toggle behind desk lamps and software buttons.

Inputs and outputs

TagTypeDefaultDescription
In_ButtonBOOLPush button input
Out_LampBOOLLamp drive signal

Required behavior

  • Lamp output inverts its current state on each rising edge of the push button input.