You read the GPIO. If there is a high voltage (3V3) it will read 1, if there is a low voltage (ground, 0V) it will read 0.

Pin 26 is (Broadcom) GPIO 7.

Ensure that you do not feed a voltage greater then 3V3 into a Pi GPIO. You will likely damage the GPIO and/or the Pi itself.

There are several Python GPIO libraries.

See http://elinux.org/RPi_GPIO_Code_Samples#Python

Answer from joan on Stack Exchange
🌐
Raspberry Pi Forums
forums.raspberrypi.com › board index › using the raspberry pi › beginners
Viewing GPIO Status - Raspberry Pi Forums
November 11, 2021 - Don’t install wiringpi. Install raspi-gpio if you have not already got it. Then this will show all GPIO
Discussions

python 3.x - RPi.GPIO pins - check state - Stack Overflow
I'm using the RPi.GPIO module in Python to turn on and off GPIO pins on the Raspberry Pi 3. Is there a way to identify whether an output pin is ON or OFF and put that value into a variable that I ... More on stackoverflow.com
🌐 stackoverflow.com
raspberry pi - How to check current state of GPIO pin via Python? - Stack Overflow
I want to check state of GPIO pin when I start, a porgram. For example I have another program which changing state of pin ( if is low change to hihg, and if is high change to low). And now I want to More on stackoverflow.com
🌐 stackoverflow.com
Viewing GPIO Status - Raspberry Pi Forums
If I run "sudo gpio -v" I get: ".... Raspberry Pi Details: Type: Unknown17, Revision: 02, Memory: 0MB, Maker: Sony * Device tree is enabled. More on raspberrypi.org
🌐 raspberrypi.org
March 22, 2018
RPI3 how can I test the GPIO pins is working or dead? - Raspberry Pi Forums
Here a screengrab: pi@CB_SD21:~ $ uname -a Linux CB_SD21 4.9.21-v7+ #986 SMP Tue Apr 11 17:06:55 BST 2017 armv7l GNU/Linux pi@CB_SD21:~ $ gpio -v gpio version: 2.44 Copyright (c) 2012-2017 Gordon Henderson This is free software with ABSOLUTELY NO WARRANTY. For details type: gpio -warranty Raspberry ... More on raspberrypi.org
🌐 raspberrypi.org
April 13, 2017
🌐
LinuxConfig
linuxconfig.org › home › how to check gpio status
Check GPIO Status on Raspberry Pi Easily
February 27, 2024 - In this tutorial, we saw how to check the status of a GPIO pin on the Raspberry Pi. We accomplished this by importing the RPi.GPIO Python library, and then using Python commands to interact with a GPIO pin and check its current status. This is only one of the many ways available, but certainly one of the most common, since a large amount of users choose to script in Python for interfacing with external hardware components.
🌐
Fleetstack
fleetstack.io › blog › check-gpio-pin-states-raspberry-pi
How to Check GPIO Pin States on Raspberry Pi
July 2, 2024 - The sysfs interface provides a method to interact with GPIO pins directly from the file system. ... Export the pin you want to check. Replace PIN_NUMBER with the pin number you are interested in (BCM numbering). ... The output will be 0 (LOW) or 1 (HIGH). Python provides a more flexible and programmable way to check GPIO pin states.
🌐
Obico
plugins.octoprint.org › plugins › gpiostatus
GPIO Status
January 8, 2022 - Check the Raspberry GPIO status and other hardware data. This OctoPrint plugin allows to check the GPIO status by the web interface, without the need to connect via SSH. It also permits knowing services’ status and hardware information. This plugin doesn’t know which pins are in use and which are free, since its purpose is to just show their state.
🌐
Raspberry Pi Forums
forums.raspberrypi.com › board index › community › general discussion
Command to check GPIO'S? - Raspberry Pi Forums
October 11, 2021 - I wrote a replacement (which uses pigpiod) - which has the advantage of displaying the ACTUAL programmed GPIO function if changed. https://www.raspberrypi.org/forums/view ... 6&t=254071 ... The "raspi-gpio get" command will list the status of all GPIOs (not just those available on the connector).
Find elsewhere
🌐
Raspberry Pi Forums
forums.raspberrypi.com › board index › using the raspberry pi › beginners
Utility to display GPIO status? - Raspberry Pi Forums
""" with open('/proc/cpuinfo', 'r') as f: for line in f.readlines(): if 'Revision' in line: REV = line.split(':')[1] REV = REV.strip() # Revision as string return int(REV, base=16) def main(): global TYPE, rev rev = get_hardware_revision() if(rev & 0x800000): # New Style TYPE = (rev&0x00000FF0)>>4 else: # Old Style rev &= 0x1F MM = [0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 3, 6, 2, 3, 6, 2] TYPE = MM[rev] # Map Old Style revision to TYPE print_gpio(pin_state) if __name__ == '__main__': main() ... For a remote display you could tailor this to your needs. http://abyz.me.uk/rpi/pigpio/examples.h ... _status_py
🌐
The Robotics Back-End
roboticsbackend.com › home › raspberry pi’s gpios default state
Raspberry Pi's GPIOs Default State - The Robotics Back-End
December 30, 2021 - GPIOs 9 to 27: default state is 0 (LOW, or close to 0V). Here’s a Python code you can run on your Raspberry Pi to test yourself. If you don’t know how to run a Python script on your Pi, check out this intro to Thonny IDE (for Raspberry Pi OS), or how to run a Python program in the terminal.
🌐
GitHub
gist.github.com › aitzol › 1b1642712146adf5bcd8
Python code to check any Raspberry Pi GPIO status · GitHub
April 16, 2019 - Python code to check any Raspberry Pi GPIO status. GitHub Gist: instantly share code, notes, and snippets.
🌐
Stack Overflow
stackoverflow.com › questions › 36114706 › how-to-check-current-state-of-gpio-pin-via-python
raspberry pi - How to check current state of GPIO pin via Python? - Stack Overflow
import RPi.GPIO as GP import subprocess as sub a=sub.check_output(['sudo', 'gpio', '-g','read','21']) print a · but what if I don't have installed wiringpi on my Raspberry Pi? (gpio command is in wiringpi package). I suppose it can look like: if GP.output(NRpin,1)==True: print "HI" elif GP.output(NRpin,0)==True: print "LO" but without: GP.setup(NRpin,GP.OUT) I cannot use that code.
🌐
GitHub
gist.github.com › yuma-m › 64563e78b1a9e29b0e18
Print Raspberry Pi GPIO Pin Status · GitHub
Print Raspberry Pi GPIO Pin Status · Raw · raspi_gpio_pin.py · This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
🌐
Raspberry Pi Forums
forums.raspberrypi.com › board index › using the raspberry pi › beginners
[solved] How do I check the status of a GPIO from the terminal? - Raspberry Pi Forums
I'm trying to control the Pi GPIO via a program called Ren'Py. In order to do so I need to import RPI.GPIO into Ren'Py and write some functions that will toggle the GPIO pins high/low I'm looking for a way to check if everything works without having to wire up an LED or some other hardware.
🌐
Raspberry Pi
raspberrypi.org › forums › viewtopic.php
RPI3 how can I test the GPIO pins is working or dead? - Raspberry Pi Forums
April 13, 2017 - $ sudo pigpiod $ ls gpiotest $ ls -l total 4 -rwxr-xr-x 1 joan joan 2420 Apr 13 15:19 gpiotest $ ./gpiotest This program checks the Pi's (user) gpios. The program reads and writes all the gpios. Make sure NOTHING is connected to the gpios during this test. The program uses the pigpio daemon ...
🌐
Raspberry Pi Forums
forums.raspberrypi.com › board index › hardware and peripherals › interfacing (dsi, csi, i2c, etc.)
Want to read the status of a GPIO OUT pin - Raspberry Pi Forums
import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(8, GPIO.OUT) while True: GPIO.output(8, GPIO.HIGH) time.sleep(5) GPIO.output(8, GPIO.LOW) time.sleep(5) and this is the code that is reading the state of the output, as you can see we setup the same gpio 8 as an output but we are reading the state of the pin with an input.
🌐
GitHub
github.com › zeljkoavramovic › pigpioread
GitHub - zeljkoavramovic/pigpioread: Show Raspberry Pi GPIO pin status, configuration and functions · GitHub
pigpioread is a tool for Raspberry Pi that provides a convenient way to view the current status, configuration and all potential capabilities of each GPIO pin, with a nice feature to easily see what pins can be used for I2C, what pins for PWM, etc.
Author   zeljkoavramovic
🌐
Embedded Computing Design
embeddedcomputing.com › technology › processing › interface-io › quick-start-raspberry-pi-gpio-terminal-interface
Quick Start: Raspberry Pi GPIO Terminal Interface - Embedded Computing Design
February 17, 2022 - Also, when running commands, make ... in your MacOS system... Ask me how I know this. ... Once logged on, at the pi@raspbeerrypi prompt, enter raspi-gpio help to see what GPIO commands are available....
🌐
Raspberry Pi
raspberrypi.org › forums › viewtopic.php
How get status of GPIO pins(high or low)? - Raspberry Pi Forums
September 18, 2015 - I have it all working and turning the light on and off, I just want some sort of status light so I can tell if the light is on or off. It's definitely needed in case I accidently turn it on when I'm away from the light and can't tell if it's on or off. Sorry if it isn't clear, if it's not then I can clearify in future posts or add anymore needed info. Thanks! ... Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ): https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555