Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- import RPi.GPIO as GPIO
- MY_PIN = 2
- GPIO.setmode(GPIO.BOARD)
- GPIO.setup(MY_PIN, GPIO.IN)
- try:
- while 1:
- if GPIO.input(MY_PIN) == GPIO.LOW:
- print "Signal is LOW"
- else:
- print "Signal is HIGH"
- time.sleep(0.1)
- except KeyboardInterrupt:
- pass
- GPIO.cleanup()
- print "BYE!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement