Posted On: September 25th 2026, 11:32 am
To get the switch to work, we can't hook it directly to 5volts or ground, we have to use a pull up or pull down resistor
Depending on which type of resistor you pick, you get different reaction. I'll break it down
A push button has four pins arranged in two permanently connected pairs, meaning you bridge the circuit by wiring across opposite sides rather than adjacent pins.
When you wire a pull-up resistor between 5V and an Arduino read pin, that pin defaults to reading a steady HIGH signal while the button is unpressed because current has nowhere else to go.
Pressing the button closes the path directly to ground, causing electricity to take the path of least resistance and pulling the pin's reading down to LOW.
Your Arduino simply watches for that drop to LOW to send power to your LED, and releasing the button restores the pin to HIGH, cutting power and turning the light off.