What Is GPIO? Wiring and Errors (2026 Guide)

What Is GPIO? Wiring and Errors (2026 Guide)

GPIO stands for General Purpose Input/Output — the pins on a microcontroller that you can program as either an input (reading a voltage from a sensor or button) or an output (driving a voltage to an LED or motor driver). Every sensor and actuator you use goes through a GPIO pin.

Quick answer: A GPIO pin can be an output (digitalWrite, pushes 5V or 0V) or an input (digitalRead, reads high or low). On an Arduino Uno, the ATmega328P gives you 14 digital I/O pins, 6 of them PWM-capable, plus 6 analog inputs — all at 5V logic. Always call pinMode() before using a pin, since it defaults to input.

Proof of work: the explanation and code below are Soldr's actual answer to "What is GPIO and how do I use it?", asked through Compoden's AI build assistant on 11 August 2026. Published 11 August 2026 · Last updated 11 August 2026.

Soldr's answer explaining GPIO: output vs input vs analog input vs PWM, and the Uno's 14 digital + 6 analog pins
Soldr's build log answering "What is GPIO and how do I use it?" — the four pin modes and a button-LED sketch generated in the same session.

What are the four things a GPIO pin can do?

Every GPIO use case is one of four modes, and knowing which one you need avoids most beginner confusion. Output pushes the pin to 5V (high) or 0V (low) — digitalWrite(13, HIGH) lights an LED. Input reads whether the pin sees high or low — digitalRead(2) tells you if a button is pressed. Analog input is a special input that measures a range rather than just high/low, but only certain pins (A0–A5 on the Uno) can do it. PWM fakes an analog output by toggling high/low very fast, and on the Uno only pins 3, 5, 6, 9, 10, and 11 support analogWrite.

GPIO on an Arduino Uno (ATmega328P)
Property Value
Digital I/O pins 14 total, 6 of them PWM-capable
Analog input pins 6 (A0–A5)
Logic level 5V
Max current per pin ~40mA — drive an LED through a resistor, never a motor directly

How do you wire a button and an LED to an Arduino Uno?

The Uno's built-in LED on pin 13 means the simplest possible first circuit needs just one external part: a push button, using the pin's internal pull-up so no resistor is required. This is the exact sketch from Soldr's session:

const int buttonPin = 2;
const int ledPin = 13;

void setup() {
  pinMode(buttonPin, INPUT_PULLUP); // internal pull-up, no external resistor needed
  pinMode(ledPin, OUTPUT);
}

void loop() {
  if (digitalRead(buttonPin) == LOW) { // pressed = LOW with pull-up
    digitalWrite(ledPin, HIGH);
  } else {
    digitalWrite(ledPin, LOW);
  }
}

Captured verbatim from the session's Firmware tab. Wire one leg of the button to pin 2 and the other to GND — INPUT_PULLUP handles the rest internally.

What are the three mistakes that burn GPIO beginners?

First: not calling pinMode() — a pin defaults to input, so code that assumes a pin is already an output will silently do nothing. Second: pulling a pin past its logic voltage — the Uno is 5V logic, and while most 3.3V sensors have 5V-tolerant pins, you should never feed a GPIO pin something like 12V directly. Third: drawing more than roughly 40mA from a single pin — an LED needs a current-limiting resistor (commonly 220Ω), and a motor needs a proper driver circuit; never wire a motor straight to a GPIO pin.

What do you need to try this yourself?

An Uno R3 CH340G ATmega328P Board (Rs.230) — the standard teaching board (its CH340G chip just means you may need to install a USB driver on some operating systems) — and a Tactile Button Pack (10x 6mm Switches) (Rs.95). The Uno's own onboard LED on pin 13 means you're doing real GPIO work in under an hour with nothing else.

Frequently asked questions

GPIO ka full form kya hai?

GPIO ka matlab hai General Purpose Input/Output - yeh microcontroller ke woh pins hain jinhe aap apni marzi se input ya output banwa sakte hain. Input mode mein pin sensor ya button se voltage padhta hai; output mode mein pin LED ya motor driver ko voltage bhejta hai.

Why does my LED not turn on even though the code looks correct?

The most common cause is a missing or wrong pinMode() call - if the pin defaults to input, digitalWrite to it has no visible effect. The second most common cause is wiring the LED backwards; LEDs only conduct in one direction, so check that the longer leg (anode) connects toward the current source.

What is the price of an Arduino Uno for learning GPIO in India?

The Uno R3 CH340G ATmega328P Board costs Rs.230 at Compoden, with cash on delivery available across India. Add a Tactile Button Pack (Rs.95) and you have everything needed for this guide's button-and-LED demo, using the board's own built-in pin-13 LED. Prices checked 11 August 2026.

What is the difference between INPUT and INPUT_PULLUP?

Plain INPUT leaves the pin electrically "floating" when nothing is connected, which can read random noise as HIGH or LOW. INPUT_PULLUP enables the chip's internal pull-up resistor, holding the pin at a steady HIGH until something (like a button to GND) pulls it LOW — which is why a button read with INPUT_PULLUP reads LOW when pressed, not HIGH.

Back to blog