INPUT and OUTPUT GPIO Pins with Arduino: A Beginner's Guide

GPIO (General Purpose Input/Output) pins on an Arduino are like the arms and legs of your board – they allow it to interact with the outside world by sending or receiving signals. In this guide, we'll demystify the concepts of INPUT and OUTPUT pins, and show you how to use them for simple interactions.


An INPUT pin on an Arduino is used to read signals from external devices, like buttons, sensors, or switches. It's like your board is listening to what's happening outside.

Example: Reading a Button Press

Let's say you have a button connected to a digital pin (like pin 2). Here's how you can read its state:


An OUTPUT pin on an Arduino is used to send signals to external devices, like LEDs, motors, or relays. It's like your board is telling other components what to do.

Example: Controlling an LED

Let's say you have an LED connected to a digital pin (like pin 13). Here's how you can control it:

Putting It All Together:

You can combine INPUT and OUTPUT pins to create interactive projects. For example, you could use an INPUT pin to read a sensor's data and then use an OUTPUT pin to control an actuator based on that data.


- `pinMode(pin, MODE)` sets a pin's mode as INPUT or OUTPUT.

- `digitalRead(pin)` reads the state of an INPUT pin (returns HIGH or LOW).

- `digitalWrite(pin, STATE)` sets the state of an OUTPUT pin (HIGH or LOW).

As you gain experience, you'll find that Arduino's flexibility with GPIO pins opens up endless possibilities – from building simple button-controlled LEDs to creating complex robotics and automation projects. So start tinkering, and let your creativity and curiosity lead the way!