Skip to main content

rpi-gpio-devices

Control Raspberry Pi gpio pins more easily.

This module provides an abstraction layer to control connected devices (fans, switches, LEDs, buttons) more easily with ready to use device classes and functions.

It uses the RPi.GPIO module to control the GPIO pins. Currently this is the recommended module to use for archlinuxarm, but it only provides basic functions to manipulate the pins.

Installation

pip install rpi-gpio-devices

pypi

Few examples

Automatic fan control based on CPU temp

from time import sleep

from rpi_gpio_devices import Fan

# Basic usage
pwm_fan = Fan(power=29, sense=35, pwm=33)

try:
    while True:
        pwm_fan.auto_set()
except KeyboardInterrupt:
    pwm_fan.cleanup()

Set LED brightness with PWM

from time import sleep

from rpi_gpio_devices import PWMLED

pwmled = PWMLED(33)

pwmled.set_brightness(50)
sleep(2)
pwmled.set_brightness(100)
sleep(2)
pwmled.set_brightness(0)
# pwmled.turn_off() # Or simply just turn it off

pwmled.cleanup()

Check if a button is pressed

from time import sleep

from rpi_gpio_devices import Button

button = Button(11)

try:
    while True:
        if button.is_pressed():
            print('Button is pressed!')
        sleep(0.5)
except KeyboardInterrupt:
    button.cleanup()

More in the examples directory.

Metadata

Release files for rpi-gpio-devices 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rpi-gpio-devices 2.0.1
File Size Uploaded Provenance Actions
rpi_gpio_devices-2.0.1.tar.gz 6.7 kB Without provenance Details for rpi_gpio_devices-2.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rpi-gpio-devices 2.0.1
File Interpreter ABI Platform Actions
rpi_gpio_devices-2.0.1-py3-none-any.whl Python 3 none any Details for rpi_gpio_devices-2.0.1-py3-none-any.whl

Total release size: 15.3 kB

Release files / rpi_gpio_devices-2.0.1.tar.gz

Download URL rpi_gpio_devices-2.0.1.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
89b2ad9f5e917eea8474f3bbb5f4691399c564b45f9a48fd9f0ff51846243cbf
BLAKE2b-256 checksum
How to use checksums
e0b6fbe43b03e2045da5b366055ce06c0e3b36396d6dec700bec2129506fee85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.2

Release files / rpi_gpio_devices-2.0.1-py3-none-any.whl

Download URL rpi_gpio_devices-2.0.1-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f1c2dbaf948ddc95e350e5c1bb384b6a164f79e0251567462c151cd1b1f8f4e3
BLAKE2b-256 checksum
How to use checksums
ae6ebad7e869f354394244dac2a866c4a67a1fed11d9d773cad34847ab4d4e98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.2

Security for rpi-gpio-devices 2.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page