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

View File

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