๐ŸŒ
SparkFun Learn
learn.sparkfun.com โ€บ tutorials โ€บ raspberry-gpio โ€บ python-rpigpio-example
Python (RPi.GPIO) Example - Raspberry gPIo - SparkFun Learn
language:Python # External module imports import RPi.GPIO as GPIO import time # Pin Definitons: pwmPin = 18 # Broadcom pin 18 (P1 pin 12) ledPin = 23 # Broadcom pin 23 (P1 pin 16) butPin = 17 # Broadcom pin 17 (P1 pin 11) dc = 95 # duty cycle (0-100) for PWM pin # Pin Setup: GPIO.setmode(GPIO.BCM) # Broadcom pin-numbering scheme GPIO.setup(ledPin, GPIO.OUT) # LED pin set as output GPIO.setup(pwmPin, GPIO.OUT) # PWM pin set as output pwm = GPIO.PWM(pwmPin, 50) # Initialize PWM on pwmPin 100Hz frequency GPIO.setup(butPin, GPIO.IN, pull_up_down=GPIO.PUD_UP) # Button pin set as input w/ pull-up # Initial state for LEDs: GPIO.output(ledPin, GPIO.LOW) pwm.start(dc) print("Here we go!
Discussions

RPi.GPIO equivalent in CircuitPython
There is an example on the Adafruit site. More on reddit.com
๐ŸŒ r/raspberrypipico
6
0
February 21, 2023
I just got a Raspberry Pi. What's the best way to learn how to use the GPIO interface?
If you're having trouble with the circuit side of things, I've made a few videos that go over the basics of using the GPIO pins. My students usually learn the following: GPIO header basics Light an LED using the 5V rail Use Python and a GPIO pin to control an LED There's also plenty of good videos from the Raspberry Pi V Beginners channel on YouTube. More on reddit.com
๐ŸŒ r/raspberry_pi
47
60
May 8, 2014
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
๐ŸŒ r/raspberry_pi
22
4
March 15, 2024
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
๐ŸŒ r/raspberry_pi
2
5
August 23, 2015
๐ŸŒ
DEV Community
dev.to โ€บ admantium โ€บ gpio-programming-on-the-raspberry-pi-python-libraries-4e5m
GPIO Programming on the Raspberry Pi: Python Libraries - DEV Community
August 30, 2021 - Gpiozero is already installed in the current Raspberry Pi OS - if not, just run python3 -m pip gpiozero. The source code files can be accessed on Github. The official documentation on readthedocs.io provides rich information and plenty example code.
๐ŸŒ
Python Programming
pythonprogramming.net โ€บ gpio-example-raspberry-pi
Programming GPIO example
First, to use GPIO, you will need to make sure you have the packages necessary on your Raspberry Pi. Via the Pi terminal, type: sudo apt-get install python-rpi.gpio
๐ŸŒ
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 15, 2024 - You can generate the documentation, such as it is, locally with `python3 -m pydoc gpiod` for the text version, or `python3 -m pydoc -p 1234` and pointing your browser at http://localhost:1234/gpiod.html for the html version. ... The AI made me this code for my gpiod v1 and it works.
๐ŸŒ
SourceForge
sourceforge.net โ€บ home โ€บ browse โ€บ raspberry-gpio-python โ€บ wiki
raspberry-gpio-python / Wiki / BasicUsage
Your script could break between revisions of Raspberry Pi boards. ... It is possible that you have more than one script/circuit on the GPIO of your Raspberry Pi. As a result of this, if RPi.GPIO detects that a pin has been configured to something other than the default (input), you get a warning ...
๐ŸŒ
Phazertech
phazertech.com โ€บ tutorials โ€บ rpi-gpio.html
GPIO Python Guide
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.
Find elsewhere
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ introduction-to-python-raspberry-pi-rpigpio-library
Introduction to Python Raspberry Pi (RPiGPIO) Library - GeeksforGeeks
July 23, 2025 - Before we can start using the RPi.GPIO module, we need to install it. The module is typically included in older versions of Raspbian OS but is not compatible with Raspberry Pi 5. We can easily install it using Python PIP.
๐ŸŒ
PyPI
pypi.org โ€บ project โ€บ RPi.GPIO
RPi.GPIO ยท PyPI
Download URL: RPi.GPIO-0.7.1-cp27-cp27mu-linux_armv6l.whl ... Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/30.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.1 keyring/23.2.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.10.2 ยท See more details on using hashes here. ... AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page
      ยป pip install RPi.GPIO
    
Published ย  Feb 06, 2022
Version ย  0.7.1
๐ŸŒ
Instructables
instructables.com โ€บ circuits โ€บ raspberry pi
Raspberry Pi: Python Scripting the GPIO : 8 Steps (with Pictures) - Instructables
October 17, 2017 - Raspberry Pi: Python Scripting the GPIO: The GPIO: General Purpose Input/Output lets you interface your Raspberry Pi with the outside world, making it a powerful interactive device for just $40-$50. This Instructable will show you how to install the GPIO package on your Raspberry Pi and hโ€ฆ
๐ŸŒ
Python Programming
pythonprogramming.net โ€บ gpio-raspberry-pi-tutorials
GPIO (General Purpose Input Output) Pins - Raspberry Pi ...
Now you can turn your Raspberry Pi on, and we'll begin the code. ... You probably already have it, but just to make sure. Next, create a new python file, and let's begin: import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM)
๐ŸŒ
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) ...
๐ŸŒ
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.
๐ŸŒ
Medium
medium.com โ€บ writearobot โ€บ basic-setup-and-working-with-raspberry-pis-rpi-gpio-module-of-python-d6bb3ea0d9ea
Basic setup and working with raspberry piโ€™s RPI GPIO Module of python | by Surya Teja | writearobot | Medium
April 17, 2018 - sudo pip install RPi.GPIO# If you face any problem in installing the package install python-dev and try again ... The GPIO.BOARD option specifies that you are referring to the pins by the number of the pin the the plug i.e the numbers printed ...
๐ŸŒ
The Pi Hut
thepihut.com โ€บ home โ€บ the pi hut tutorials โ€บ how to install the gpio python library
How to Install the GPIO Python Library
July 3, 2019 - There are several GPIO Python libraries available but we recommend you use the one found at http://pypi.python.org/pypi/RPi.GPIO. Although it is possible to download the library through a web browser it's much faster to do the installation process through the terminal on your raspberry pi.
๐ŸŒ
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 - Looking through the docs for RPi.GPIO, I found a method called GPIO.cleanup() and another great blog post with a pretty good error handling pattern that I decided to employ. Error handling is an important part of developing software of all kinds, but has pretty significant implications when a error on the Pi could short out some physical hardware if not handled appropriately. I do want to take just a second and talk about the pattern I used, the try/except/finally block in Python.
๐ŸŒ
Ubuntu
ubuntu.com โ€บ tutorials โ€บ gpio-on-raspberry-pi
How to use Raspberry Pi GPIO pins with Ubuntu | Ubuntu
No resistor is needed for the PWM pin, which is GPIO 18 in the example script. The fan model I am using has an open-collector circuit design (as do most fans), so a 1kฮฉ pull-up resistor is needed. NOTE: The pull-up resistor must be connected to one of the 3.3V pins on the Raspberry Pi. If it is connected to a 5V pin, the Pi could be severely damaged. See the wiring diagram below as an example: After connecting the fan and Raspberry Pi, run the following Python ...
๐ŸŒ
SparkFun Learn
learn.sparkfun.com โ€บ tutorials โ€บ raspberry-gpio โ€บ python-rpigpio-api
Python (RPi.GPIO) API - Raspberry gPIo - SparkFun Learn
PWM on the Raspberry Pi is about as limited as can be -- one, single pin is capable of it: 18 (i.e. board pin 12). To initialize PWM, use GPIO.PWM([pin], [frequency]) function. To make the rest of your script-writing easier you can assign that instance to a variable.