print the input
This commit is contained in:
parent
e41ea22006
commit
55e226d50d
27
server.py
27
server.py
@ -41,20 +41,21 @@ def off():
|
|||||||
@app.route("/colour")
|
@app.route("/colour")
|
||||||
@retry(stop=stop_after_attempt(5))
|
@retry(stop=stop_after_attempt(5))
|
||||||
def hello():
|
def hello():
|
||||||
print(request.query_string)
|
print(request.args.get("rgb"))
|
||||||
r = int(request.args.get("r"))
|
# rgb = (request.args.get("rgb")
|
||||||
g = int(request.args.get("g"))
|
# r = int(request.args.get("r"))
|
||||||
b = int(request.args.get("b"))
|
# g = int(request.args.get("g"))
|
||||||
hex = rgb2hex(r, g, b)
|
# b = int(request.args.get("b"))
|
||||||
hex = hex.replace("#", "")
|
# hex = rgb2hex(r, g, b)
|
||||||
|
# hex = hex.replace("#", "")
|
||||||
|
|
||||||
str = "56" + hex + "00f0aa"
|
# str = "56" + hex + "00f0aa"
|
||||||
result = subprocess.run(
|
# result = subprocess.run(
|
||||||
[f"gatttool -i hci0 -b b2:3b:03:00:14:d6 --char-write-req -a 0x0009 -n {str}"],
|
# [f"gatttool -i hci0 -b b2:3b:03:00:14:d6 --char-write-req -a 0x0009 -n {str}"],
|
||||||
stdout=subprocess.PIPE,
|
# stdout=subprocess.PIPE,
|
||||||
shell=True,
|
# shell=True,
|
||||||
).stdout.decode("utf-8")
|
# ).stdout.decode("utf-8")
|
||||||
print(result)
|
# print(result)
|
||||||
if "Characteristic value was written successfully" not in result:
|
if "Characteristic value was written successfully" not in result:
|
||||||
raise Exception
|
raise Exception
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user