Created
June 5, 2015 11:49
-
-
Save Gadgetoid/0ada0059bafe84a1dddc to your computer and use it in GitHub Desktop.
Toggle Explorer HAT's LEDs and outputs using the cap touch buttons
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
import explorerhat | |
import signal | |
def toggle_output(channel, event): | |
print("Got {} on channel {}".format(event, channel)) | |
if channel < 5: | |
explorerhat.light[channel-1].write(event=='press') | |
explorerhat.output[channel-1].write(event=='press') | |
explorerhat.touch.pressed(toggle_output) | |
explorerhat.touch.released(toggle_output) | |
signal.pause() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment