Merge branch 'sound' into 'master'

Sound geändert und draw borders

See merge request !2
This commit is contained in:
Patrick Tschuchnig 2019-10-29 15:58:31 +01:00
commit 291eb7b746
3 changed files with 15 additions and 10 deletions

View File

@ -238,6 +238,9 @@ import RPi.GPIO as GPIO
pygame_fps = 30 #frames per second setting
pygame_clock = pygame.time.Clock()
# enable border drawing
cfg_borders_enabled = False
# GPIO for Buttons
pin_start = 32
pin_stop = 37
@ -284,7 +287,8 @@ screen_size_x = pygame.display.Info().current_w
screen_size_y = pygame.display.Info().current_h
# load sound effects
error_sound = pygame.mixer.Sound('snd/buzz.wav')
#error_sound = pygame.mixer.Sound('snd/buzz.wav')
error_sound = pygame.mixer.Sound('snd/nope.wav')
logoff_sound = pygame.mixer.Sound('snd/winxplogoff.wav')
# fonts
@ -381,7 +385,7 @@ def change_red(amount):
global led_red
factor = 100/255
led_green.ChangeDutyCycle(amount*factor)
led_red.ChangeDutyCycle(amount*factor)
def change_green(amount):
"""
@ -496,7 +500,7 @@ def enter_name():
screen.blit(textbox_surface, textbox_rectangle)
# add the border and logos
#draw_border()
draw_border()
draw_logos()
# display everything
@ -586,7 +590,8 @@ def draw_background():
def draw_border():
"""draw rectangle border around everything"""
pygame.draw.rect(screen, pygame_color_black, (500, 200, (screen_size_x-500*2), (screen_size_y-200*2)), 5)
if cfg_borders_enabled:
pygame.draw.rect(screen, pygame_color_black, (500, 200, (screen_size_x-500*2), (screen_size_y-200*2)), 5)
def draw_logos():
"""draw logos"""
@ -852,7 +857,7 @@ while True:
pass
# overlaying structure - this is to be drawn no matter what's below
#draw_border()
draw_border()
draw_logos()
# flip everything, update display, do a tick

View File

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

BIN
snd/nope.wav Normal file

Binary file not shown.