Created
April 28, 2013 04:44
-
-
Save basuke/5475916 to your computer and use it in GitHub Desktop.
Raspberry Pi Kitchen Range Monitor using GPIO
This file contains hidden or 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 | |
from sys import exit | |
GPIO.setmode(GPIO.BCM) | |
pins = [18,23,24,25] | |
[GPIO.setup(pin, GPIO.IN) for pin in pins] | |
print "Ready." | |
while True: | |
try: | |
states = [GPIO.input(pin) for pin in pins] | |
#print states | |
print " ".join("ON " if state else "OFF" for state in states) | |
sleep(1) | |
except KeyboardInterrupt: | |
exit() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment