Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

libgpiod python ctypes binding

Project description

GPIO NEXT

This is a python ctypes binding for libgpiod.

It's time to switch from the GPIO sysfs interface to gpiod to the linux GPIO character device (gpiod, stands for GPIO device)

Since linux 4.8 the GPIO sysfs interface is deprecated. User space should use the character device instead. This library encapsulates the ioctl calls and data structures behind a straightforward API.

from kernel.org

Requirements

  • libgpiod1

Install

sudo apt install libgpiod1
pip install gpio-next

Usage

  1. turn on/off an LED
import time
from gpio_next import Output

LED = Output(64, default_value=0)
for i in range(10):
    LED.write(i & 1)
    time.sleep(1)
  1. detect button events
from gpio_next import Input

button = Input(203)

for i in range(10):
    print(button.wait())
    print(button.read())

Project details


Release history Release notifications

Download files

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

Files for gpio-next, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size gpio-next-0.0.3.tar.gz (4.6 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page