diff --git a/API/main.py b/API/main.py index 0b4814c..66a2078 100644 --- a/API/main.py +++ b/API/main.py @@ -9,6 +9,34 @@ import time, threading api = Flask(__name__) +@api.route('/text', methods=['POST']) +def display_text(): + response = { 'success': True } + try: + global matrix + + data = request.get_json() + text = data.get('text') + x_coord = data.get('x') + y_coord = data.get('y') + + matrix.text(x_coord, y_coord, text) + except: + response['success'] = False + + return jsonify(response) + +@api.route('/update', methods=['GET']) +def update_matrix(): + response = { 'success': True } + + try: + global matrix + matrix.update() + except: + response['success'] = False + + return jsonify(response) class Matrix(SampleBase):