Skip to content

Instantly share code, notes, and snippets.

@Gadgetoid
Created June 5, 2015 11:49
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 Gadgetoid/0ada0059bafe84a1dddc to your computer and use it in GitHub Desktop.
Save Gadgetoid/0ada0059bafe84a1dddc to your computer and use it in GitHub Desktop.
Toggle Explorer HAT's LEDs and outputs using the cap touch buttons
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