Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. import RPi.GPIO as GPIO
  2. import time
  3. import os
  4.  
  5. GPIO.setmode(GPIO.BCM)
  6.  
  7. GPIO.setup(23, GPIO.IN, pull_up_down=GPIO.PUD_UP)#Button to GPIO23
  8. GPIO.setup(24, GPIO.OUT) #LED to GPIO24
  9.  
  10. try:
  11. while True:
  12. button_state = GPIO.input(23)
  13. if button_state == False:
  14. GPIO.output(24, True)
  15. os.system("python3 ~/Desktop/apscan2db.py")
  16. time.sleep(0.2)
  17. else:
  18. GPIO.output(24, False)
  19. except:
  20. GPIO.cleanup()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement