Guest User

Multiple Button GPIO

a guest
Oct 30th, 2014
204
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(24, GPIO.IN, pull_up_down=GPIO.PUD_UP)
  7. GPIO.setup(20, GPIO.IN, pull_up_down=GPIO.PUD_UP)
  8. while True:
  9.  
  10. if (GPIO.input(24) == False):
  11. print('Button Pressed')
  12. time.sleep(0.2)
  13.  
  14. elif (GPIO.input(20) == False):
  15. print('Button 2 Pressed')
  16. time.sleep(0.2)
RAW Paste Data