🌐
SparkFun Learn
learn.sparkfun.com › tutorials › raspberry-gpio › python-rpigpio-example
Python (RPi.GPIO) Example - Raspberry gPIo - SparkFun Learn
Here's an example sketch that incorporates everything we learned on the last page. It does a little input and output, and even handles some PWM. This assumes you've set up the circuit as arranged on the Hardware Setup page. 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
🌐
Python Programming
pythonprogramming.net › gpio-example-raspberry-pi
Programming GPIO example
Here we are setting the mode to BCM, which is the naming convention for the GPIO pins. You can either address the pins by their actual physical pin number, or their "name" assigned to them.
🌐
Electropeak
electropeak.com › learn › tutorial-raspberry-pi-gpio-programming-using-python-full-guide
Raspberry Pi GPIO Pins Programming Using Python [Full Guide]
March 3, 2024 - Learn how to control Raspberry Pi GPIO pins using Python. Understand about GPIO pinout, programming, installation, commands, and examples
🌐
PyPI
pypi.org › project › RPi.GPIO
RPi.GPIO · PyPI
For examples and documentation, visit http://sourceforge.net/p/raspberry-gpio-python/wiki/Home/
      » pip install RPi.GPIO
    
Published   Feb 06, 2022
Version   0.7.1
🌐
Readthedocs
python-periphery.readthedocs.io › en › latest › gpio.html
GPIO — python-periphery 2.4.1 documentation
from periphery import GPIO # Open GPIO /dev/gpiochip0 line 10 with input direction gpio_in = GPIO("/dev/gpiochip0", 10, "in") # Open GPIO /dev/gpiochip0 line 12 with output direction gpio_out = GPIO("/dev/gpiochip0", 12, "out") value = gpio_in.read() gpio_out.write(not value) gpio_in.close() ...
🌐
ICS
ics.com › blog › control-raspberry-pi-gpio-pins-python
Control Raspberry Pi GPIO Pins from Python | ICS
July 31, 2019 - The example code in this blog post is written for Python 3 and should work on any Raspberry Pi model. Raspberry-gpio-python [2] or RPi.GPIO, is a Python module to control the GPIO interface on the Raspberry Pi.
🌐
SparkFun Learn
learn.sparkfun.com › tutorials › raspberry-gpio › python-rpigpio-api
Python (RPi.GPIO) API - Raspberry gPIo - SparkFun Learn
Now then. Lets incorporate everything we learned here into an example script to try everything out. ... Pages Introduction GPIO Pinout Hardware Setup Python (RPi.GPIO) API Python (RPi.GPIO) Example C (WiringPi) Setup C (WiringPi) API C (WiringPi) Example Using an IDE!
🌐
SourceForge
sourceforge.net › home › browse › raspberry-gpio-python › wiki
raspberry-gpio-python / Wiki / Examples
Wiki: BasicUsage Wiki: Checking function of GPIO channels Wiki: Home Wiki: Inputs Wiki: Outputs Wiki: PWM
🌐
SourceForge
sourceforge.net › home › browse › raspberry-gpio-python › wiki
raspberry-gpio-python / Wiki / BasicUsage
GPIO.setmode(GPIO.BOARD) # or GPIO.setmode(GPIO.BCM) To detect which pin numbering system has been set (for example, by another Python module): mode = GPIO.getmode() The mode will be GPIO.BOARD, GPIO.BCM or None · It is possible that you have more than one script/circuit on the GPIO of your Raspberry Pi.
Find elsewhere
🌐
Phazertech
phazertech.com › tutorials › rpi-gpio.html
GPIO Python Guide
July 6, 2024 - For example, you could use a 10K resistor for R2 and a 6.8K resistor for R1, just like I did in the push button example. Now copy and paste the following code into a new Python file and run it: from gpiozero import DistanceSensor import time ultrasonic = DistanceSensor(echo=17, trigger=4) while ...
🌐
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…
🌐
Egb320
egb320.github.io › WebsiteFiles › GPIOpython.html
Raspberry Pi GPIO and Python Tutorial
import RPi.GPIO as GPIO # Import ... can run the script by running the following command within the terminal: ... This example demonstrates how to perform software PWM to flash an LED....
🌐
pytz
pythonhosted.org › RPIO
Welcome to RPIO’s documentation! — RPIO 0.10.0 documentation
rpio – command-line tools for inspecting and manipulating GPIOs system-wide. ... $ curl -L https://github.com/metachris/RPIO/archive/master.tar.gz | tar -xz $ cd RPIO-master $ sudo python setup.py install · Debian packages are available at metachris.github.com/rpio/download. After the installation you can use import RPIO as well as the command-line tool rpio. You can find lots of examples inside the documentation, as well as in the /examples/ source directory.
🌐
SparkFun Learn
learn.sparkfun.com › tutorials › raspberry-gpio › all
Raspberry gPIo - SparkFun Learn
RPi.GPIO API -- An overview of the Python functions you can use to drive GPIO. RPi.GPIO Example -- An example Python script that shows off both input and output functionality.
🌐
Cmac-duke
cmac-duke.github.io › physical-computing › tutorials › pi-gpio
Raspberry Pi Zero and GPIO
We can interact with the pin we defined above with ‘GPIO.output’. Here we’re referencing the pin, and setting the output of the pin to high, much like we would with the Particle Photons. This will output 3.3v to pin 23 ... We can start to set up our program much like we would with the Photons, with a “setup” function and a “loop” function. Since there is no set syntax for python and no “special functions”, we could call these functions anything we want, but for now we’ll stick with “setup” and “loop”
🌐
GeeksforGeeks
geeksforgeeks.org › python › introduction-to-python-raspberry-pi-rpigpio-library
Introduction to Python Raspberry Pi (RPiGPIO) Library - GeeksforGeeks
July 23, 2025 - One of the key features that make the Raspberry Pi so popular is its General Purpose Input/Output (GPIO) pins. These pins allow us to interact with the outside world by connecting sensors, LEDs, motors, and other hardware components. To control these GPIO pins using Python, the RPi.GPIO module ...
🌐
gpiozero
gpiozero.readthedocs.io › en › stable › recipes.html
2. Basic Recipes — gpiozero 2.0.1 Documentation
If you prefer a version that works under IDLE, the following recipe should suffice: from gpiozero import Robot, Motor from evdev import InputDevice, list_devices, ecodes robot = Robot(left=Motor(4, 14), right=Motor(17, 18)) # Get the list of available input devices devices = [InputDevice(device) ...
🌐
Medium
medium.com › geekculture › gpio-programming-on-the-raspberry-pi-python-libraries-e12af7e0a812
GPIO Programming on the Raspberry Pi: Python Libraries | by Sebastian | Geek Culture | Medium
August 31, 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.
🌐
Instructables
instructables.com › circuits › raspberry pi
GPIOs + More Python : 16 Steps - Instructables
May 29, 2020 - GPIOs + More Python : This lesson teaches you how to use the General Purpose Input/Outputs (GPIOs) on your Raspberry Pi to control an LED and read a button’s state. The circuit you build in this lesson will be used in the photo booth final project. You will be introduced…