Last active
August 6, 2017 20:28
-
-
Save legotheboss/12dec53d4c2257ed38013ee64fda1324 to your computer and use it in GitHub Desktop.
Python Script to Read Garage Sensor
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
from time import sleep | |
import RPi.GPIO as GPIO | |
GPIO.setmode(GPIO.BOARD) | |
GPIO.setup(12, GPIO.IN) | |
while True: | |
if (GPIO.input(12) == True): | |
print('Garage Door Closed') | |
else: | |
print('Garage Door Open') | |
sleep(1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If using this with the Garage door tutorial from quick pi you need to change input_pin to 12 for it to work then run it using sudo python read_sensor.py