Created
November 27, 2019 19:17
-
-
Save ianiv/8bdc8ddeb87a4b7a3134b56296c4fc91 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
import wiringpi2 | |
import http.client, urllib | |
def dingdong(): | |
conn = http.client.HTTPSConnection("api.pushover.net:443") | |
conn.request("POST", "/1/messages.json", | |
urllib.parse.urlencode({ | |
"token": "token", | |
"user": "user", | |
"message": "Ding Dong!", | |
"priority": 1, | |
}), { "Content-type": "application/x-www-form-urlencoded" }) | |
conn.getresponse() | |
wiringpi2.wiringPiSetup() | |
wiringpi2.pinMode(5, 0) | |
while (1): | |
wire = wiringpi2.digitalRead(5) | |
#print(wire) | |
if (wire == 1): | |
#print("Ding Dong!\n") | |
dingdong() | |
wiringpi2.delay(5000) | |
wiringpi2.delay(100) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment