Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import RPi.GPIO as GPIO
- import time
- GPIO.setmode(GPIO.BCM)
- GPIO.setup(13,GPIO.IN,pull_up_down=GPIO.PUD_UP)
- GPIO.setup(5,GPIO.OUT)
- def prints(CH) :
- print ('Button 1 Pressed')
- try :
- GPIO.add_event_detect(13,GPIO.RISING,callback=prints,bouncetime=300)
- while True :
- GPIO.output(5,1)
- time.sleep(0.2)
- GPIO.output(2,0)
- time.sleep(0.2)
- finally :
- GPIO.cleanup()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement