From 1366ac23ced8a3a2c3ef9350b337387c435ff37f Mon Sep 17 00:00:00 2001 From: SC13NC3F1CT10N <60079422+SC13NC3F1CT10N@users.noreply.github.com> Date: Wed, 30 Sep 2020 16:21:29 -0400 Subject: [PATCH] Updated the code --- shortcutmaster.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/shortcutmaster.py b/shortcutmaster.py index 9d7b399..90ccfe0 100644 --- a/shortcutmaster.py +++ b/shortcutmaster.py @@ -1,6 +1,6 @@ -# Shortcut Master for Raspberry Pi Version 1.0 +# Shortcut Master for Raspberry Pi Version 1.1 # This is the main code for the program, it was designed by SC13NC3F1CT10N (username) -# Version code started 04/09/2020 and ended 04/10/2020 +# Version code made 04/10/2020 ## SETUP ## @@ -24,6 +24,11 @@ def wunp(): # Create wunp (wait until not pushed) function while GPIO.input(10) == GPIO.HIGH: pass +sound = True # Set to False if you don't want sound or set to True if you want sound + +def playsound(): # This function plays sound when sound is enabled. + if sound == True: + system("mpg123 /home/pi/ShortcutMaster_Raspberry-Pi/sounds/launch.mp3") # Let the user know the program is ready to begin GPIO.output(8, GPIO.HIGH) print("Ready") @@ -34,22 +39,27 @@ def wunp(): # Create wunp (wait until not pushed) function # If button (1 to 4) is pushed, execute set command then stop the script if GPIO.input(10) == GPIO.HIGH: print("Execute: " + func1) + playsound() system(func1) stop = True wunp() if GPIO.input(12) == GPIO.HIGH: print("Execute: " + func2) + playsound() system(func2) stop = True wunp() if GPIO.input(16) == GPIO.HIGH: print("Execute: " + func3) + playsound() system(func3) stop = True wunp() if GPIO.input(18) == GPIO.HIGH: print("Execute: " + func4) + playsound() system(func4) stop = True wunp() + print("Goodbye")