-
-
Save Jxck-S/c4a627a45bf00fa4047481d288fb7c5e 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('\x1b[1;37;42m' + 'Garage Door Closed' + '\x1b[0m') | |
else: | |
print('\x1b[1;37;43m' + 'Garage Door Open' + '\x1b[0m') | |
sleep(1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment