Aaron Dale, Web Developer

Projects - Feedback - Code

Python Program for Raspberry Pi

This is a simple program for a Raspberry Pi which triggers a cloud server script when a door sensor is tripped.

import RPi.GPIO as GPIO import time import urllib GPIO.setmode(GPIO.BCM) GPIO.setup(14,GPIO.IN) time.sleep(5) while True: if GPIO.input(14) == True: html=urllib.urlopen('https://sensors.cdnja.com/door/') time.sleep(60) else: time.sleep(0.5) time.sleep(0.5) GPIO.cleanup()

Portfolio - Feedback - Code