Skip to content

sardok/txgpio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

txgpio

Twisted-based asynchronous library for using GPIO (over Sysfs) implemented in pure python.

Reading

Define protocol

class SysfsGPIOProtocol(Protocol):

    def dataReceived(self, data):
        self.factory.on_receive(data)

Define factory

class SysfsGPIOFactory(Factory):
    protocol = SysfsGPIOProtocol

    def on_receive(self, data):
        log.msg('Read value: {}'.format(data))

Create instances

    factory = SysfsGPIOFactory()
    protocol = factory.buildProtocol(None)
    GPIO(protocol, reactor=reactor, gpio_no=21, edge='both')

Let the reactor run

reactor.run()

See examples/ directory for reader & writer applications.

About

Twisted-based asynchronous library for using GPIO.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages