Skip to main content

gpio access via the standard linux sysfs interface

Project description

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gpio-1.0.1.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

gpio-1.0.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file gpio-1.0.1.tar.gz.

File metadata

  • Download URL: gpio-1.0.1.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.2

File hashes

Hashes for gpio-1.0.1.tar.gz
Algorithm Hash digest
SHA256 2deb1dcd8be1b11e61ffe8701cbb32f3a354902467f16a55fd2d7724e5a3d631
MD5 c68b4f177822086a40b3ab0cb77f4645
BLAKE2b-256 c0211655623a323191d7c01ee05ac23b75ad98ed8e2b889eba6febd166ca2cb2

See more details on using hashes here.

File details

Details for the file gpio-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: gpio-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.2

File hashes

Hashes for gpio-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 56e75e24d569048add247085936fc8f8c12324265d78b21293f9fa7e9c199610
MD5 935930995a8bf9646a5635318a535ac9
BLAKE2b-256 6a7e9d81b4012363b68ee88aeff04f8c44cc9dc1c1d307356eb06cf3b745a826

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page