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()