Building a Pull-Up / Pull-Down Resistor Circuit
Why a digital input pin needs a resistor holding it to a known state, even when its switch is open.
You'll need: a push-button, a resistor (commonly 10kΩ), a supply, and a way to measure or read the output (a multimeter, or a microcontroller input pin once you reach Lesson 28).
Wire a switch directly to a digital input with nothing else connected, and when that switch is open, the input isn't reliably HIGH or LOW — it's floating, picking up tiny stray electrical noise from nearby wires and randomly reading as either state. A pull-up or pull-down resistor fixes this by giving the pin a defined default state whenever the switch is open.
In a pull-down setup, a resistor connects the input pin to ground, and the switch connects the pin to the supply. Switch open: the resistor holds the pin firmly at 0V (LOW). Switch closed: the supply overpowers the resistor's weak pull and the pin reads HIGH.
A pull-up setup is the mirror image: the resistor connects the pin to the supply (holding it HIGH by default), and the switch connects the pin to ground when pressed (pulling it LOW). Many microcontrollers include this resistor built in, selectable in software — but on a plain breadboard circuit, you'll wire it externally exactly as described here.