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.

Source Distribution

g4l-0.1.4.tar.gz (3.6 kB view hashes)

Uploaded Source

Built Distribution

g4l-0.1.4-py3-none-any.whl (3.9 kB view hashes)

Uploaded Python 3

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