Skip to content

Instantly share code, notes, and snippets.

@rmolina
Created June 17, 2015 17:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmolina/d885f1ea07db2cfeeb9a to your computer and use it in GitHub Desktop.
Save rmolina/d885f1ea07db2cfeeb9a to your computer and use it in GitHub Desktop.
Using the onboard led and button on a MIPS® Creator CI20 board
from twisted.internet import reactor
from sysfs.gpio import GPIOController as Controller
from sysfs.gpio import GPIOPinDirection as Direction
from sysfs.gpio import GPIOPinEdge as Edge
Controller().available_pins = [113, 175]
led = Controller().alloc_pin(175, Direction.OUTPUT)
def btn_changed(pin, state): led.value(state)
btn = Controller().alloc_pin(113, Direction.INPUT, btn_changed, Edge.BOTH)
reactor.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment