Skip to content

Instantly share code, notes, and snippets.

@ianiv
Created November 27, 2019 19:17
Show Gist options
  • Save ianiv/8bdc8ddeb87a4b7a3134b56296c4fc91 to your computer and use it in GitHub Desktop.
Save ianiv/8bdc8ddeb87a4b7a3134b56296c4fc91 to your computer and use it in GitHub Desktop.
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