From 7bdbc9a737630554a18ce6c1fae582aaed2de276 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ebbe=20Ba=C3=9F?= Date: Mon, 16 May 2022 21:36:58 +0200 Subject: [PATCH] maybe fixxed power MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ebbe Baß --- main.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/main.py b/main.py index 8784a1b..89391e2 100644 --- a/main.py +++ b/main.py @@ -117,7 +117,6 @@ if __name__ == '__main__': @app.route('/mode', methods=['GET']) def mode(): global mode - global power global r global g global b @@ -142,14 +141,14 @@ if __name__ == '__main__': mode = 1 return 'Color: '+str(r)+','+str(g)+','+str(b) - @app.route('/power') + @app.route('/power', methods=['GET']) def power(): - if power == True: - power = False - return "Power off" - else: - power = True - return "Power on" + global power + power = request.args.get('power') + if power is None: + return 'No power argument specified' + elif power == "": + return 'No power argument specified' strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL) strip.begin()