fixed missing input declaration

This commit is contained in:
Patrick Tschuchnig 2019-09-13 12:15:30 +02:00
parent 6f69b471e5
commit 12ceaa7265
2 changed files with 18 additions and 17 deletions

View File

@ -165,9 +165,9 @@ max_name_length = 10
hs1_name = "Fritz"
hs2_name = "Bernd"
hs3_name = "Max"
hs1_time = 100
hs2_time = 200
hs3_time = 300
hs1_time = 100000
hs2_time = 200000
hs3_time = 300000
############################################
############ END OF DEFINITIONS ############
@ -202,6 +202,7 @@ pygame_font_main_color = pygame_color_black
# initialise gpio
GPIO.setmode(GPIO.BOARD)
GPIO.setup(pin_start, GPIO.IN)
GPIO.setup(pin_stop, GPIO.IN)
GPIO.setup(pin_error, GPIO.IN)
GPIO.setup(pin_shutdown, GPIO.IN)
@ -366,7 +367,7 @@ def handle_events():
exit_application()
# shutdown raspberry if shutdown pin is detected
if GPIO.INPUT(pin_shutdown):
if GPIO.input(pin_shutdown):
shutdown_raspberry()
def exit_application():
@ -444,12 +445,12 @@ def enter_name():
# none of the following may be needed
# TODO: Testing
# if someone presses the erase key, erase 1 letter
#elif event.key == pygame.K_BACKSPACE:
# name = name[:-1]
elif event.key == pygame.K_BACKSPACE:
name = name[:-1]
#
#elif event.type == KEYDOWN and event.key == pygame.K_RETURN:
# clear_screen()
# return name
elif event.type == KEYDOWN and event.key == pygame.K_RETURN:
clear_screen()
return name
# this part of the code should be unreachable, and only here in case the event handling goes wrong horribly.
clear_screen()
@ -510,8 +511,8 @@ def show_debug():
print('Game running: ' + str(game_running))
print('Game ending: ' + str(game_ending))
print('Pin status: ')
print('Start pin: ' + str(GPIO.INPUT(pin_start)))
print('Error pin: ' + str(GPIO.INPUT(pin_error)))
print('Start pin: ' + str(GPIO.input(pin_start)))
print('Error pin: ' + str(GPIO.input(pin_error)))
print('Shutdown pin: ' + str(GPIO.input(pin_shutdown)))
print('#############')

View File

@ -110,9 +110,9 @@ led_init()
while True:
change_led_colour(99,0,99)
time.sleep(0.2)
change_led_colour(0,99,99)
time.sleep(0.2)
change_led_colour(99,99,0)
time.sleep(0.2)
#change_led_colour(100,0,0)
#time.sleep(10)
#change_led_colour(0,100,0)
#time.sleep(10)
change_led_colour(0,0,100)
time.sleep(10)