mirror of
https://gitlab1.ptb.de/waltem01/Matrix
synced 2024-12-25 03:31:44 +00:00
set color endpoint
This commit is contained in:
parent
3bac768b06
commit
d492525bd3
18
API/main.py
18
API/main.py
@ -44,6 +44,24 @@ def set_pixel():
|
||||
|
||||
return jsonify(response)
|
||||
|
||||
@api.route('/color', methods=['POST'])
|
||||
def set_color():
|
||||
response = { 'success': True }
|
||||
try:
|
||||
global matrix
|
||||
|
||||
data = request.get_json()
|
||||
red = data.get('r')
|
||||
green = data.get('g')
|
||||
blue = data.get('b')
|
||||
|
||||
matrix.set_color(red, green, blue)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
response['success'] = False
|
||||
|
||||
return jsonify(response)
|
||||
|
||||
@api.route('/update', methods=['GET'])
|
||||
def update_matrix():
|
||||
response = { 'success': True }
|
||||
|
Loading…
Reference in New Issue
Block a user