GPIO Foundations
~10 min slides
What is GPIO?
General Purpose Input/Output
Standard digital interface to the outer world. The most basic peripheral: making pins go high or low, and reading whether they're high or low.
Configurations: Direction
- Output — you drive the pin (e.g., turn on an LED)
- Input — you read the pin (e.g., detect a button press)
Configurations: Output
Modes
- Push-pull (typically default) — actively drives the pin high and low
- Open-drain — actively drives low, but floats when "high" (needs external pull-up)
Drive Strength
How much current the pin can source or sink. Higher drive strength = brighter LED, but more power consumption.
Configurations: Input
Internal Pull Resistor
- Pull-up — pin reads high when nothing is connected; button pulls it low
- Pull-down — pin reads low when nothing is connected; button pulls it high
- Floating — no pull resistor; pin state is undefined when nothing is connected