Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import RPi.GPIO as GPIO
- from time import sleep
- GPIO.setmode(GPIO.BCM)
- GPIO.setup(25, GPIO.OUT)
- GPIO.setup(24, GPIO.IN, pull_up_down=GPIO.PUD_UP)
- def button(channel):
- if GPIO.input(24):
- print "falling edge detected on port 24"
- else:
- print "rising edge detected on port 24"
- GPIO.add_event_detect(24, GPIO.BOTH, callback=my_callback)
- while 1:
- sleep(30)
- GPIO.cleanup()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement