Skip to main content

gpio for linux

Project description

g4l

Usage

class

  • Gpio(num)
    • parameter
      • num : gpio number

methods

  • Gpio.direction(dir)

    • parameters
      • dir : pin's direction ( Gpio.IN, Gpio.OUT )
  • Gpio.edge(edge)

    • parameters
      • edge : interrupt edge (Gpio.NONE, Gpio.RISING, Gpio.FALLING, Gpio.BOTH)
  • Gpio.input()

    • returns
      • input value
  • Gpio.output(value)

    • parameters
      • value : output value
  • Gpio.setisr(isr)

    • parameters
      • isr : interrupt service routines's callback function

example

input interrupt

from time import sleep
from g4l import Gpio

print('g4l example')
gpio = Gpio(100)
gpio.direction(Gpio.IN)
gpio.edge(Gpio.RISING)
gpio.setisr(lambda:print('gpio isr'))

print('loop start - toggle gpio')
cnt = 0
while True:
    print(f'loop {cnt}')
    cnt += 1
    sleep(5)

Project details


Download files

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

Files for g4l, version 0.1.3
Filename, size File type Python version Upload date Hashes
Filename, size g4l-0.1.3-py3-none-any.whl (3.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size g4l-0.1.3.tar.gz (2.6 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page