Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. @reboot sudo python /home/pi/quiz/quiz.py &
  2.  
  3. #example of a question
  4. def question2():
  5. print("Question2")
  6. while True:
  7. if GPIO.input(quiz_button1) == False:
  8. answer_correct(2)
  9. play_sound(fact_sound_2)
  10. break
  11. elif GPIO.input(quiz_button2) == False:
  12. answer_wrong(led_wrong)
  13. elif GPIO.input(quiz_button3) == False:
  14. answer_wrong(led_wrong)
  15. elif GPIO.input(quiz_button4) == False:
  16. answer_wrong(led_wrong)
  17. turn_led_on(ind_led2)
  18.  
  19. def main():
  20. turn_all_leds_off()
  21. try:
  22. while True:
  23. # starts quiz
  24. find_null()
  25. print("Start of quiz")
  26. question1()
  27. question2()
  28. question3()
  29. question4()
  30.  
  31. finally:
  32. GPIO.cleanup()
  33.  
  34. if __name__ == "__main__":
  35. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement