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 mimick 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.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for gpio-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4d2de56cfde25fb1a6d71dbd60da59698cc9dabe9bcabf3548aa8e22ecf1cea3
MD5 270558d8c137209eb3f3597efcf07310
BLAKE2b-256 3d1412f7715abee718d57757519edac43ff57370ae5e2aea03cb75fe14fb2ff4

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for gpio-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 25afec3f69c47d4b1253ab5b525abe48db6488331c77bda4b85c84b58343e9c2
MD5 146c4b10fcc9b4879c5ca0c37909b28d
BLAKE2b-256 196855f18a729289c413102ec9c9d21ac5a34c9b8fdbf28d8ee0b51052527b52

See more details on using hashes here.

Supported by

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