added sound effects, changed screen resolution setup to be detection based rather than manually entered
This commit is contained in:
parent
d5d79416e3
commit
2baa5e4e7b
@ -454,7 +454,7 @@ def handle_events():
|
|||||||
exit_application()
|
exit_application()
|
||||||
|
|
||||||
# shutdown raspberry if shutdown pin is detected
|
# shutdown raspberry if shutdown pin is detected
|
||||||
if GPIO.input(pin_shutdown):
|
if not GPIO.input(pin_shutdown):
|
||||||
shutdown_raspberry()
|
shutdown_raspberry()
|
||||||
|
|
||||||
def exit_application():
|
def exit_application():
|
||||||
@ -715,7 +715,7 @@ while True:
|
|||||||
|
|
||||||
# event handling for if the start button is pushed
|
# event handling for if the start button is pushed
|
||||||
#wait for the user to press start button
|
#wait for the user to press start button
|
||||||
if GPIO.input(pin_start) and not pin_start_inhibit:
|
if not GPIO.input(pin_start) and not pin_start_inhibit:
|
||||||
# change game state to running and not ending
|
# change game state to running and not ending
|
||||||
game_running = True
|
game_running = True
|
||||||
game_ending = False
|
game_ending = False
|
||||||
@ -753,7 +753,7 @@ while True:
|
|||||||
pin_start_inhibit = False
|
pin_start_inhibit = False
|
||||||
|
|
||||||
# add errors if error pin is detected, only once per 500 ms
|
# add errors if error pin is detected, only once per 500 ms
|
||||||
if GPIO.input(pin_error):
|
if not GPIO.input(pin_error):
|
||||||
if not error_added:
|
if not error_added:
|
||||||
errors += 1
|
errors += 1
|
||||||
error_added = True
|
error_added = True
|
||||||
@ -791,7 +791,7 @@ while True:
|
|||||||
#pygame.display.flip()
|
#pygame.display.flip()
|
||||||
|
|
||||||
# if another push of start is detected (i.e. the game is ending!)
|
# if another push of start is detected (i.e. the game is ending!)
|
||||||
if GPIO.input(pin_stop):
|
if not GPIO.input(pin_stop):
|
||||||
# change led colour to red
|
# change led colour to red
|
||||||
change_led_colour(200, 0, 200)
|
change_led_colour(200, 0, 200)
|
||||||
|
|
||||||
|
24
pud_test.py
Normal file
24
pud_test.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
#coding=utf-8
|
||||||
|
|
||||||
|
import signal
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import time
|
||||||
|
import RPi.GPIO as GPIO
|
||||||
|
|
||||||
|
############################################
|
||||||
|
############## END OF IMPORTS ##############
|
||||||
|
|
||||||
|
# GPIO for Buttons
|
||||||
|
pin_start = 36
|
||||||
|
|
||||||
|
|
||||||
|
# initialise gpio
|
||||||
|
GPIO.setmode(GPIO.BOARD)
|
||||||
|
GPIO.setup(pin_start, GPIO.IN)
|
||||||
|
|
||||||
|
while True:
|
||||||
|
print(GPIO.input(pin_start))
|
||||||
|
time.sleep(1)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user