Home / Learn Embedded C / Pull-Up and Pull-Down Resistors
Pull-Up and Pull-Down Resistors
Keeping an input pin at a known, stable level when nothing is actively driving it.
The idea, explained simply
The basic idea
A pull-up or pull-down resistor connects an input pin weakly to a known voltage (high or low) so the pin reads a defined level when nothing else is actively driving it, instead of "floating" at an unpredictable value.
Why this comes up
A button wired to only connect a pin to ground when pressed will read an undefined, noisy value when NOT pressed unless a pull-up resistor holds it HIGH in that state — this is one of the most common early hardware bugs.
The mechanics
Many microcontrollers include a configurable internal pull-up or pull-down resistor on each GPIO pin, avoidable without any extra external component — selected via a configuration register alongside direction.
Where it is used
- Button/switch wiring
- Unused pin configuration
- Noise-free input reads
Try it
With a pull-up resistor, the resting (unpressed) state reads HIGH, and pressing the button pulls it LOW — hence checking for LOW to detect a press.
Try it: comparing pull-up vs pull-down wiring choices
Pull-down wiring flips the polarity compared to pull-up wiring: the same code must check the opposite level.
Quick check
1. What problem does a pull-up or pull-down resistor solve for an input pin?
Without a pull resistor, an input pin with nothing actively driving it can read as noise — the pull resistor guarantees a known default level.