Guest User

Untitled

a guest
May 25th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. import RPi.GPIO as GPIO
  2. import time
  3. GPIO.setmode(GPIO.BCM)
  4. GPIO.setwarnings(False)
  5.  
  6. LED1=18
  7. Butn1=17
  8.  
  9. GPIO.setup(LED1,GPIO.OUT)
  10. GPIO.setup(Butn1,GPIO.IN, pull_up_down=GPIO.PUD_UP)
  11.  
  12. score=0
  13. game=True
  14.  
  15. while game==True:
  16. GPIO.output(LED,GPIO.HIGH)
  17. input_state=GPIO.input(Butn1)
  18. if input_state==False:
  19. print('02')
  20. GPIO.output(LED1,GPIO.LOW)
  21. time.sleep(2)
  22. score+=1
  23. print(score)
  24. elif input_state==True:
  25. print('03')
  26. GPIO.output(LED1,GPIO.LOW)
  27. time.sleep(2)
  28. print (score)
Add Comment
Please, Sign In to add comment