From 55e226d50d5c4ae2b94fba3dc62ac87ba6f40740 Mon Sep 17 00:00:00 2001 From: "karl.hudgell" Date: Tue, 26 Oct 2021 16:25:57 +0100 Subject: [PATCH] print the input --- server.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/server.py b/server.py index 04dc437..546433b 100644 --- a/server.py +++ b/server.py @@ -41,20 +41,21 @@ def off(): @app.route("/colour") @retry(stop=stop_after_attempt(5)) def hello(): - print(request.query_string) - r = int(request.args.get("r")) - g = int(request.args.get("g")) - b = int(request.args.get("b")) - hex = rgb2hex(r, g, b) - hex = hex.replace("#", "") + print(request.args.get("rgb")) + # rgb = (request.args.get("rgb") + # r = int(request.args.get("r")) + # g = int(request.args.get("g")) + # b = int(request.args.get("b")) + # hex = rgb2hex(r, g, b) + # hex = hex.replace("#", "") - str = "56" + hex + "00f0aa" - result = subprocess.run( - [f"gatttool -i hci0 -b b2:3b:03:00:14:d6 --char-write-req -a 0x0009 -n {str}"], - stdout=subprocess.PIPE, - shell=True, - ).stdout.decode("utf-8") - print(result) + # str = "56" + hex + "00f0aa" + # result = subprocess.run( + # [f"gatttool -i hci0 -b b2:3b:03:00:14:d6 --char-write-req -a 0x0009 -n {str}"], + # stdout=subprocess.PIPE, + # shell=True, + # ).stdout.decode("utf-8") + # print(result) if "Characteristic value was written successfully" not in result: raise Exception else: