Created
June 17, 2015 17:36
-
-
Save rmolina/d885f1ea07db2cfeeb9a to your computer and use it in GitHub Desktop.
Using the onboard led and button on a MIPS® Creator CI20 board
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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