From 95a1873ad8ee47b3e14d465207f91e0c0c85d1e6 Mon Sep 17 00:00:00 2001 From: overflowerror Date: Wed, 22 Apr 2015 22:10:20 +0200 Subject: [PATCH] some optimizations --- script/buttons.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/script/buttons.py b/script/buttons.py index 295c7a9..d9f9be5 100644 --- a/script/buttons.py +++ b/script/buttons.py @@ -9,23 +9,23 @@ GPIO.setup(14,GPIO.IN,pull_up_down=GPIO.PUD_UP) GPIO.setup(15,GPIO.IN,pull_up_down=GPIO.PUD_UP) GPIO.setup(18,GPIO.IN,pull_up_down=GPIO.PUD_UP) +#how are you turning them off again? + while True: input_state1 = GPIO.input(14) input_state2 = GPIO.input(15) input_state3 = GPIO.input(18) if input_state1 == False: print('Button 1, Steckdose 1 an') - time.sleep(1.5) - os.system("sh 11.sh") + os.system("./regenerate.sh 11") if input_state2 == False: - print('Button 2, Steckdose 2 an') - os.system("sh 21.sh") - time.sleep(1.5) + print('Button 2, Steckdose 2 an') + os.system("./regenerate.sh 21") if input_state3 == False: - print('Button 3, Steckdose 3 an') - os.system("sh 31.sh") - time.sleep(1.5) - + print('Button 3, Steckdose 3 an') + os.system("./regenerate.sh 31") + # if you don't sleep in a while true loop you are going to burn your only cpu core + time.sleep(1.5) #s01 = open("status_01.txt", "r") #s01.close