[image] f3lix0928: how to set GPIO as a input and output. using pinMode() Answer from gcjr on forum.arduino.cc
🌐
Electronic Wings
electronicwings.com › arduino › digital-gpio-of-arduino
Digital GPIO of Arduino | Arduino
We have to configure these pins to use as output. To configure these pins, pinMode() function is used which set direction of pin as input or output. ... This function is used to configure GPIO pin as input or output.
🌐
Arduino Forum
forum.arduino.cc › projects › programming
How to set GPIO as a input and output - Programming - Arduino Forum
January 10, 2023 - Good Evening guys. I am asking about how to set GPIO as a input and output. My Board is ESP32 Wroom and I am still newbie in this part. So my company ask me to do this one~ I have no idea to do this So I hope someone el…
Discussions

How to set GPIO as a input and output
Good Evening guys. I am asking about how to set GPIO as a input and output. My Board is ESP32 Wroom and I am still newbie in this part. So my company ask me to do this one~ I have no idea to do this So I hope someone el… More on forum.arduino.cc
🌐 forum.arduino.cc
10
1
January 11, 2023
How to set GPIO as a input and output
Good Evening guys. I am asking about how to set GPIO as a input and output. My Board is ESP32 Wroom and I am still newbie in this part. So my company ask me to do this one~ I have no idea to do this So I hope someone el… More on forum.arduino.cc
🌐 forum.arduino.cc
18
1
January 10, 2023
How to program Arduino to listen for GPIO *input* from raspberry pi's GPIO *output*
You need at least two wires, one for the signal and one for ground. No way around that. They need to have some common reference point to be able to figure out what is high and what is low. You could potentially use the mains wiring for that but I hardly need to stress how stupid that is. More on reddit.com
🌐 r/arduino
24
10
October 14, 2015
🌐
Arduino Forum
forum.arduino.cc › projects › programming
GPIO input and output pins code - Programming - Arduino Forum
March 15, 2017 - Hello everyone, I have some questions about Arduino GPIO. I am using an Arduino Uno board and I would like to use GPIO to enable two Digital pins (pins 2 and 3) as inputs. I would like to be able to detect a LOW voltage (0.0 volts) as a 0 and a HIGH voltage (5.0 volts) as a 1. I have been doing research online and I found an example about how to enable input and output GPIO pins in the setup function using PORT-D. And the example stated how to detect a HIGH or LOW voltage in the loop function....
🌐
Espressif
docs.espressif.com › projects › arduino-esp32 › en › latest › api › gpio.html
GPIO - - — Arduino ESP32 latest documentation
The pinMode function is used to define the GPIO operation mode for a specific pin. ... INPUT sets the GPIO as input without pullup or pulldown (high impedance).
🌐
DeepBlue
deepbluembedded.com › home › blog › arduino digitalwrite() digital output (gpio) tutorial
Arduino digitalWrite() Digital Output (GPIO) Tutorial
August 17, 2023 - If you need to read the state of a push button, you’d need to configure a GPIO pin as an input pin. On the other hand, if you need to drive an LED ON or OFF, you’d need to configure a GPIO pin as an output pin to control the LED. Arduino GPIO pins can be used for various applications like ...
🌐
Kompulsa
kompulsa.com › home › arduino tutorial: controlling arduino gpio pins
Arduino GPIO Basics: How To Control The Pins On An Arduino
April 12, 2025 - The ‘digitalRead’ function returns that HIGH or LOW value we’re looking for, which means that you can simply assign that value to a variable of the integer datatype. The first step to reading an Arduino button state is to choose which pin we will connect the button to. For this example, we will use pin 11. Since a button is an input device, we need to declare its pin as an input (do this in the setup function):
🌐
Espressif Docs
espressif-docs.readthedocs-hosted.com › projects › arduino-esp32 › en › latest › api › gpio.html
GPIO — Arduino-ESP32 2.0.14 documentation
The pinMode function is used to define the GPIO operation mode for a specific pin. ... INPUT sets the GPIO as input without pullup or pulldown (high impedance).
Find elsewhere
🌐
GitHub
github.com › mikaelpatel › Arduino-GPIO
GitHub - mikaelpatel/Arduino-GPIO: General Purpose Input/Output (GPIO) library for Arduino · GitHub
The Arduino GPIO library has been developed to allow high performance digital pin access. Most access functions are compiled to a single instruction and execute in 1-2 clock cycles.
Starred by 49 users
Forked by 12 users
Languages   C++ 93.2% | C 6.8%
🌐
Random Nerd Tutorials
randomnerdtutorials.com › home › project › esp32 › esp32 digital inputs and digital outputs (arduino ide)
ESP32 Digital Inputs and Digital Outputs (Arduino IDE) | Random Nerd Tutorials
March 27, 2020 - The button is connected to GPIO 4 and the LED is connected to GPIO 5. When using the Arduino IDE with the ESP32, 4 corresponds to GPIO 4 and 5 corresponds to GPIO 5. Next, you create a variable to hold the button state.
🌐
Adafruit Playground
adafruit-playground.com › u › delucasd2 › pages › using-gpio-on-arduino
Using GPIO on Arduino. | Adafruit Playground
May 1, 2024 - /* Arduino with PIR motion sensor or light sensor for viewers Modified by @delucas based on PIR sensor or light sensor simplified with no reading values */ int led = 4; // led variable int sensor = 2; // sensor variable - middle out pin in sensor void setup() { pinMode(led, OUTPUT); // LED as is an output pinMode(sensor, INPUT); // sensor is as an input Serial.begin(9600); // initialize serial } void loop(){ if (sensor == HIGH) { // check if the sensor is HIGH digitalWrite(led, HIGH); // turn LED ON Serial.println("Motion sensed!"); delay(100); // delay 100 milliseconds digitalWrite(led, LOW); // turn LED OFF delay(200); // delay 200 milliseconds } } ... Thank you for participating in this! ... This page (Using GPIO on Arduino.) was last updated on May 01, 2024.
🌐
Pantech
pantech.ai › how-to-configure-digital-gpio-in-arduino-uno
How to configure digital GPIO in Arduino UNO – Pantech.AI
By default, Arduino pins are set as digital inputs, so explicit configuration isn’t necessary unless the pin has been previously set to an output. If you want to explicitly set a pin as an input, use the pinMode() function. This function reads the value of the specified GPIO pin, returning ...
🌐
YouTube
youtube.com › watch
Tutorial: Arduino GPIO | How to use Arduino Pins - YouTube
#TechToTinker When I am starting to learn the Arduino microcontroller, I started searching on how I am able to use it immediately because I believe that the ...
Published   June 26, 2020
🌐
Reddit
reddit.com › r/arduino › how to program arduino to listen for gpio *input* from raspberry pi's gpio *output*
r/arduino on Reddit: How to program Arduino to listen for GPIO *input* from raspberry pi's GPIO *output*
October 14, 2015 -

Current setup:

  • Raspberry Pi (RPi) running Raspbian

  • Arduino with a button connected to pin 12 and an LED attached to pin 8

I have the Arduino set up to listen for a "HIGH" value from pin 12 (currently a button is connected). When pressed, an LED connected to pin 8 turns on.

What I would like to achieve:

I would like to replace the button that is attached to Arduino pin 12 with a signal sent from the RPi's GPIO.

I imagine it being like this, but knowing almost nothing about electronics I need some advice about getting it to work:

  1. RPi pin starts off LOW, consequently so does the Arduino's pin 12.

  2. Set RPi GPIO pin to HIGH -> Arduino pin 12 records HIGH and triggers LED.

I have considered using a serial connection between the devices, but my setup assumes that the devices are on the other side of the room from each other (30 ft apart) and I only want a single wire connecting them together.

Is what I want to achieve even possible? Any help or advice would be greatly appreciated.

UPDATE: Thanks all your your replies, I have learnt a lot! I will be considering my options, especially the idea of a level shifter or RF transmitters, which are both very reasonably priced and easily available here in South Africa.

🌐
Arduino
arduino.cc › en › Tutorial › AnalogInputPins
Analog Input Pins | Arduino Documentation
The converter has 10-bit resolution, returning integers from 0 to 1023. While the main function of the analog pins for most Arduino users is to read analog sensors, the analog pins also have all the functionality of general purpose input/output (GPIO) pins (the same as digital pins 0–13).
🌐
Zbotic
zbotic.in › home › gpio pins explained: input, output and high-z state guide
GPIO Pins Explained: Input, Output and High-Z State Guide - Zbotic
March 11, 2026 - Most microcontrollers organise ... On Arduino, you interact with GPIO through simple functions like pinMode(), digitalWrite(), and digitalRead()....
🌐
Technetronelectronics
technetronelectronics.com › home › arduino gpio guide
Arduino GPIO Guide
December 21, 2025 - GPIO pins are the fundamental interface between a microcontroller and external components. These pins can be programmed as either inputs to read data or outputs to control devices.
🌐
Arnab Kumar Das
arnabkumardas.com › home › gpio concept : arduino / atmega328p
GPIO Tutorial - General Purpose Input Output - Arnab Kumar Das
July 7, 2021 - Programmable logic devices (like FPGAs) can easily provide GPIOs; multifunction chips like power managers and audio codecs often have a few such pins to help with pin scarcity on SOCs, and there are also “GPIO Expander” chips that connect using the I2C or SPI serial buses. GPIO Pins are also seen in ICs like PMICs, LED Controllers, etc. ... Inputs can often be used as IRQ (Interrupt Request) signals, Edge triggered or Level triggered.
🌐
DeepBlue
deepbluembedded.com › home › blog › esp32 gpio (digital inputs & digital outputs) – arduino tutorial
ESP32 GPIO (Digital Inputs & Digital Outputs) - Arduino Tutorial
August 17, 2023 - GPIO4 For the Push Button input, and GPIO2 for the LED output. We just read the input pin state and assign that value to the LED output pin. So that the LED is ON while the button is pressed and held, releasing the button will be read as a 0 ...