Created
May 24, 2015 20:10
-
-
Save vdavez/d39042fa598a0d0901f3 to your computer and use it in GitHub Desktop.
Raspberry Pi scripts
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
#!/usr/bin/env python3 | |
from time import sleep | |
import requests | |
try: | |
import RPi.GPIO as GPIO | |
except RuntimeError: | |
print("Error importing RPi.GPIO! This is probably because you need superuser privileges. You can achieve this by using 'sudo' to run your script") | |
GPIO.setmode(GPIO.BCM) | |
GPIO.setwarnings(False) | |
led = 12 | |
GPIO.setup(led, GPIO.OUT) | |
r = requests.head("https://esq.io") | |
if r.status_code == 200: | |
GPIO.output(led, 1) | |
sleep(10) | |
GPIO.cleanup() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment