set color endpoint

This commit is contained in:
waltem01 2023-11-23 10:46:43 +01:00
parent 3bac768b06
commit d492525bd3

View File

@ -44,6 +44,24 @@ def set_pixel():
return jsonify(response) 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']) @api.route('/update', methods=['GET'])
def update_matrix(): def update_matrix():
response = { 'success': True } response = { 'success': True }