Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import RPi.GPIO as GPIO
- from time import sleep
- from requests import get
- def main():
- URL = "http://awtosuite.pro/RaspAPI/unlock_box?id=1"
- PAUSE_IN_SECONDS = 1
- while True:
- try:
- response = get(URL)
- print(response.text)
- if(response.text == "200,1"):
- unlock()
- print("unlock")
- sleep(PAUSE_IN_SECONDS)
- except:
- print("error")
- def unlock():
- GPIO.setmode(GPIO.BCM)
- GPIO.setup(18, GPIO.OUT)
- GPIO.output(18,GPIO.HIGH)
- sleep(2)
- GPIO.output(18,GPIO.LOW)
- sleep(2)
- GPIO.output(18,GPIO.HIGH)
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement