Beginner Topic 16 of 50 Mobile, Embedded & IoT
GPIO
General-purpose pins controlled by software.
How it works
General-purpose input/output pins are digital pins on a microcontroller or computer that software can configure as inputs, to read high or low voltage levels, or outputs, to drive them. Pins may have pull-up or pull-down resistors, open-drain modes, adjustable drive strength and alternate functions that connect them to peripherals such as UART, SPI, I2C and PWM. Reading buttons and switches, lighting LEDs and toggling relays and signals use GPIO, and interrupts on pin changes provide event-driven input.
Where it is used
Blinking an LED is the hello world of embedded systems. Buttons, bit-banged protocols, chip selects, enabling sensors and interfacing logic circuits all rely on GPIO.
Common pitfall
Floating inputs read random values, so use pull resistors. Mechanical switches bounce, producing multiple edges, so debounce in hardware or software. Pins can source or sink only limited current, often 20 milliamps, and exceeding it damages the chip; use transistors or drivers for larger loads. Voltage levels must match, such as 3.3 versus 5 volts. Check the pin multiplexing in the datasheet.
Where it fits in the course
GPIO is topic 16 of 50 in Mobile, Embedded & IoT, rated Beginner. It follows Raspberry Pi. The next topic is Sensors and Actuators.
Practice and explore
- Open the interactive lesson, with a mini quiz.
- Take the Mobile, Embedded & IoT quiz.
How to study this topic
- Read the explanation above and restate the definition in your own words.
- Open the interactive lesson and answer its mini quiz.
- Read the common pitfall, then write a short example that avoids it.
- Check your understanding in the Mobile, Embedded & IoT quiz, and revisit the topic if you miss a question.
Frequently asked questions
What is GPIO?
Where do people use GPIO?
What is the most common mistake with GPIO?
What should I learn before this topic?
How can I practice it?
Is GPIO hard to learn?
How long does it take to learn GPIO?
Which topics are related to GPIO?
What should I study after GPIO?
Related topics
- Raspberry Pi (Mobile, Embedded & IoT)
- Sensors and Actuators (Mobile, Embedded & IoT)
- Arduino (Mobile, Embedded & IoT)
- Analog vs Digital Signals (Mobile, Embedded & IoT)