A button is a contact switch. When it's pressed, both ends of the circuit are connected. The schematic diagram of a button is as follows:
The below figure demonstrates a circuit switching on a LED when the button is pressed:
- When the button is not pressed, the LED is not connected to GND, so it is turned off.
- When the button is pressed, there is a close loop for the circuit, therefore the LED is turned on.