Created
February 23, 2017 18:03
-
-
Save Mikulas/eef4769191e7b620d8ec46c9ad65ae64 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# $ sudo pip install slackweb | |
import RPi.GPIO as GPIO | |
import slackweb | |
slack = slackweb.Slack(url="https://hooks.slack.com/services/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") | |
GPIO.setmode(GPIO.BOARD) | |
GPIO.setup([14], GPIO.OUT) | |
GPIO.add_event_detect(14, GPIO.RISING) # add rising edge detection on a channel | |
while True: | |
if GPIO.event_detected(14): | |
print('event triggered') | |
slack.notify(text="Zvoní zvonek!", channel="@mikulas", username="Crrrrrr", icon_emoji=":bellhop_bell:") | |
time.sleep(1) | |
time.sleep(0.001) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment