PyPI
pypi.org › project › RPi.GPIO
RPi.GPIO · PyPI
This package provides a Python module to control the GPIO on a Raspberry Pi.
» pip install RPi.GPIO
Geekworm Wiki
wiki.geekworm.com › How_to_Install_RPi.GPIO_Python_Library
How to Install RPi.GPIO Python Library - Geekworm Wiki
This will now mean you can use the library within Python. import RPi.GPIO as GPIO # to use Raspberry Pi board pin numbers GPIO.setmode(GPIO.BOARD) # set up the GPIO channels - one input and one output GPIO.setup(11, GPIO.IN) GPIO.setup(12, GPIO.OUT) # input from pin 11 input_value = GPIO.input(11) # output to pin 12 GPIO.output(12, GPIO.HIGH) # the same script as above but using BCM GPIO 00..nn numbers GPIO.setmode(GPIO.BCM) GPIO.setup(17, GPIO.IN) GPIO.setup(18, GPIO.OUT) input_value = GPIO.input(17) GPIO.output(18, GPIO.HIGH) ·
Can't control GPIO through python or C
Have you tried a different pin? GPIO4 is the default 1-wire pin. More on reddit.com
Control Pi 2 GPIO pins through Python
Here's a good pinout guide: http://pi.gadgetoid.com/pinout and here are some input examples for using the RPi.GPIO Python library: http://sourceforge.net/p/raspberry-gpio-python/wiki/Inputs/ More on reddit.com
A GUI for the GPIO pins
I made a Python script that creates a graphical interface for the Pi's GPIO pins. I hope this is useful for people who are debugging a program using GPIO pins and / or people who want to use the GPIO pins without writing any code. You can either import the script into other Python programs or run it independently to manually control each pin. Please let me know if you have any questions. I have ideas to improve the program (adding PWM controls, add the ability to name pins, add the ability to save and load pin configurations, etc) but wanted to gauge interest before putting more time into the project. I wrote it on a Pi3 running Stretch so I'm not sure if it will work on other models / OS versions. Let me know if you try it on something else! The file can be found here: https://github.com/evanmoring/GPIOGUI Thanks for looking! More on reddit.com
[DIY] Use Python to Control the Pins of a Raspberry Pi to Light Up LEDs
No hate, but wouldn't this be a better project for an arduino? I don't think you need a quad core with giga bytes of ram to light up a led. An arduino uno is like 3 dollars on eBay, which makes it a much more affordable option for something like blinking LEDs. More on reddit.com
Videos
Raspberry Pi GPIO Python Guide
04:35
Raspberry Pi GPIO: A Beginner’s Guide (2025) - YouTube
13:42
Python GPIO - Input Pin Push Button Example & Compatibility With ...
10:26
Raspberry Pi GPIO Programming with Python - Part 1: Introduction ...
Raspberry Pi Full Course for Beginners | OS Setup, Python ...
10:47
You NEED to Learn Raspberry Pi GPIO Pins (Beginner to Pro) - YouTube
Viktooor
viktooor.com › crating-a-python-script-to-control-the-gpio-of-the-raspberry-pi
Crating a Python script to control the GPIO of my Raspberry Pi - viktooor.com - Tech Blog from Hungary
September 21, 2025 - pi@raspberrypi:~ $ influx Connected to http://localhost:8086 version v1.11.8 InfluxDB shell version: v1.11.8 > CREATE DATABASE temp_meas > SHOW DATABASES name: databases name ---- _internal temp_meas · Remember these, later we'll refer back to these in the Python script. That's all we need to do beforehand, now we can run the script. You can download this from my Github repo, but I also paste it here: import RPi.GPIO as GPIO import time from influxdb import InfluxDBClient from w1thermsensor import W1ThermSensor #USER INPUTS: #SPECIFY THE TARGET TEMPERATURE IN CELSIUS, #THE HYSTERESIS IN CELSI
NiceGUI
nicegui.io
NiceGUI
NiceGUI is an easy-to-use, Python-based UI framework, which shows up in your web browser. You can create buttons, dialogs, Markdown, 3D scenes, plots and much more.
Raspberry Pi Forums
forums.raspberrypi.com › board index › programming › python
What is the official Raspberry Pi library for accessing GPIO ports ? - Raspberry Pi Forums
September 14, 2024 - GPIO Zero is the recommendation in the official OS documentation: Use GPIO from Python. It should be installed by default with RPi OS 12/Bookworm. N.B. The hardware implementation of GPIO changed with the Pi5, so various other libraries won't work on the Pi5 until the library developers update ...
Raspberry Pi
projects.raspberrypi.org › en › projects › physical-computing › 1
GPIO pins - Physical Computing with Python
Learn how to use the GPIO pins on your Raspberry Pi to interface with electronic components, such as LEDs and PIRs. As well as a Raspberry Pi with an SD card and the usual peripherals, you’ll also need: There are no additional software requirements for this resource beyond what is pre-installed in the current Raspbian image. Know how wire a variety of components to the Raspberry Pi · Know how to interact with a variety of components using Python
Jeff Everhart
jeffreyeverhart.com › home › using cleanup method rpi.gpio | raspberry pi tutorial
Using cleanup method RPi.GPIO | Raspberry Pi Tutorial - Jeff Everhart Jeff Everhart
August 28, 2017 - If you look at the example code ... on the GPIO object to make sure all of the pins are reset every time you end a Python script. Not only does it make your code better to have some type of error checking implemented, it could also save you a pin or some boards down the line. I’ll be posting more frequently on the Raspberry Pi, future ...
Ubuntu
ubuntu.com › tutorials › gpio-on-raspberry-pi
How to use Raspberry Pi GPIO pins with Ubuntu | Ubuntu
But fear not, there is a new package in Ubuntu 21.04 called LGPIO that allows full control over the header pins with the latest kernel version. This tutorial covers some basic functionality of LGPIO, including examples using basic GPIO control, I²C, PWM, and SPI. If you already have Ubuntu 21.04 or newer set up on a Raspberry Pi, you are ready for this tutorial.
Raspberry Pi
raspberrypi.com › home › news › gpio zero: a friendly python api for physical computing
GPIO Zero: a friendly Python API for physical computing - Raspberry Pi
September 19, 2021 - Physical computing is one of the most engaging classroom activities, and it’s at the heart of most projects we see in the community. From flashing lights to IoT smart homes, the Pi’s GPIO pins make programming objects in the real world accessible to everybody. Some three years ago, Ben Croston created a Python library called RPi.GPIO, which he used as part of his beer brewing process.
Raspberry Pi Forums
forums.raspberrypi.com › board index › using the raspberry pi › beginners
Toggling Pi4 GPIO Outputs with Python? - Raspberry Pi Forums
## Toggle on/off (momentary) button to toggle the on/off state of an LED Light ##ledbutton.py # The button switches to Ground (active_low) with integral pullup resistor (pin 10) # The resulting output gives 3.3v on pin 12 to the LED # remember to fit a current limiting resistor to the LED!! import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BOARD) GPIO.setwarnings(False) GPIO.setup(10, GPIO.IN, pull_up_down=GPIO.PUD_UP) #Button to Pin 10 GPIO.setup(12, GPIO.OUT) #LED to Pin 12 try: times = 0 debounce = 2 state = True previous = False while True: reading = GPIO.input(10) if reading == False
Phazertech
phazertech.com › tutorials › rpi-gpio.html
GPIO Python Guide
July 6, 2024 - It turns out python3-RPi.GPIO isn't compatible with the Pi 5 but there's a drop-in replacement called rpi-lgpio and it's compatible with all Raspberry Pi versions. If you previously installed python3-RPi.GPIO, make sure you uninstall it first before installing rpi-lgpio.