Twisted-based asynchronous library for using GPIO (over Sysfs) implemented in pure python.
class SysfsGPIOProtocol(Protocol):
def dataReceived(self, data):
self.factory.on_receive(data)
class SysfsGPIOFactory(Factory):
protocol = SysfsGPIOProtocol
def on_receive(self, data):
log.msg('Read value: {}'.format(data))
factory = SysfsGPIOFactory()
protocol = factory.buildProtocol(None)
GPIO(protocol, reactor=reactor, gpio_no=21, edge='both')
reactor.run()
See examples/
directory for reader & writer applications.