fixxed code block oder of the api

master
Ebbe Baß 2022-01-04 02:42:12 +01:00
parent ee5d2fd3be
commit 3eaaae52e6
1 changed files with 13 additions and 14 deletions

27
main.py
View File

@ -11,20 +11,6 @@ except:
from flask import Flask, request
import threading
#Web API
app = Flask(__name__)
@app.route('/')
def index():
command = str(request.args.get('command'))
if command == "switch-ilde-mode":
change_idle_mode
elif command == "switch-toggle-on-off":
power_toggle
return command
# LED strip configuration:
LED_COUNT = 60 # Number of LED pixels.
LED_PIN = 18 # GPIO pin connected to the pixels (18 uses PWM!).
@ -86,6 +72,19 @@ def power_toggle(channel):
global power_button_pressed
power_button_pressed = 'True'
#Web API
app = Flask(__name__)
@app.route('/')
def index():
command = str(request.args.get('command'))
if command == "switch-ilde-mode":
change_idle_mode
elif command == "switch-toggle-on-off":
power_toggle
return command
if __name__ == '__main__':
threading.Thread(target=lambda: app.run(host="0.0.0.0", port=80, debug=True, use_reloader=False)).start()
led_power = 'True'