Skip to main content

Linux sysfs gpio access

This library provides gpio access via the standard linux sysfs interface

It is intended to mimic RPIO as much as possible for all features, while also supporting additional (and better named) functionality to the same methods.

Supported Features

  • get pin values with read(pin) or input(pin)
  • set pin values with write(pin, value), set(pin, value) or output(pin, value)
  • get the pin mode with mode(pin)
  • set the pin mode with setup(pin, mode)
    • mode can currently equal gpio.IN or gpio.OUT
  • create a GPIOPin class directly to write and read a pin

Examples

RPi.GPIO Drop-in

Good for up to 130KHz pin toggle on a Pi 400.

import time

import gpio as GPIO

GPIO.setup(14, GPIO.OUT)

while True:
    GPIO.output(14, GPIO.HIGH)
    time.sleep(1.0)
    GPIO.output(14, GPIO.LOW)
    time.sleep(1.0)

Use GPIOPin directly

Good for up to 160KHz pin toggle on a Pi 400.

This gives you a class instance you can manipulate directly, eliminating the lookup:

import gpio

pin = gpio.GPIOPin(14, gpio.OUT)

while True:
    pin.write(14, GPIO.HIGH)
    time.sleep(1.0)
    pin.write(14, GPIO.LOW)
    time.sleep(1.0)

Release files for gpio 1.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 gpio 1.0.1
File Size Uploaded
gpio-1.0.1.tar.gz 5.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gpio 1.0.1
File Interpreter ABI Platform
gpio-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.6 kB

Release files / gpio-1.0.1.tar.gz

Download URL gpio-1.0.1.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
2deb1dcd8be1b11e61ffe8701cbb32f3a354902467f16a55fd2d7724e5a3d631
BLAKE2b-256 checksum
How to use checksums
c0211655623a323191d7c01ee05ac23b75ad98ed8e2b889eba6febd166ca2cb2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.2

Release files / gpio-1.0.1-py3-none-any.whl

Download URL gpio-1.0.1-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
56e75e24d569048add247085936fc8f8c12324265d78b21293f9fa7e9c199610
BLAKE2b-256 checksum
How to use checksums
6a7e9d81b4012363b68ee88aeff04f8c44cc9dc1c1d307356eb06cf3b745a826
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.2

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

0.3.0

1 release file

0.2.0

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

0.0.4

0.0.3

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