Advertisement
Guest User

Untitled

a guest
May 30th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. import RPi.GPIO as GPIO
  2. from time import sleep
  3. GPIO.setmode(GPIO.BCM)
  4. GPIO.setup(25, GPIO.OUT)
  5. GPIO.setup(24, GPIO.IN, pull_up_down=GPIO.PUD_UP)
  6.  
  7. def button(channel):
  8. if GPIO.input(24):
  9. print "falling edge detected on port 24"
  10. else:
  11. print "rising edge detected on port 24"
  12.  
  13. GPIO.add_event_detect(24, GPIO.BOTH, callback=my_callback)
  14.  
  15. while 1:
  16. sleep(30)
  17.  
  18. GPIO.cleanup()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement