Guest User

Untitled

a guest
Jul 29th, 2015
247
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import RPi.GPIO as GPIO
  2. import time
  3.  
  4. GPIO.setmode(GPIO.BCM)  
  5.  
  6. GPIO.setup(4, GPIO.IN, pull_up_down = GPIO.PUD_UP)
  7.  
  8. def interrupt(channel):
  9.     print(GPIO.input(4))
  10.    
  11. GPIO.add_event_detect(4, GPIO.BOTH, callback = interrupt, bouncetime = 50)
  12.  
  13. while True:
  14.     time.sleep(1)
  15.     # print(GPIO.input(4))
  16.  
  17. GPIO.cleanup()
RAW Paste Data