diff --git a/API/main.py b/API/main.py index eee855d..4690754 100644 --- a/API/main.py +++ b/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 }