diff --git a/src/Python/flask/web/app.py b/src/Python/flask/web/app.py index 28c0ea8..311d6ab 100644 --- a/src/Python/flask/web/app.py +++ b/src/Python/flask/web/app.py @@ -3,14 +3,16 @@ import paho.mqtt.client as mqtt app = Flask(__name__) +kobuki_message = "empty" def on_message(client, userdata, message): global kobuki_message #set scope for this variable kobuki_message = str(message.payload.decode("utf-8")) + print(kobuki_message) # Create an MQTT client instance mqtt_client = mqtt.Client() mqtt_client.username_pw_set("server", "serverwachtwoordofzo") -mqtt_client.connect("localhost", 8080, 60) +mqtt_client.connect("localhost", 1884, 60) mqtt_client.loop_start() mqtt_client.subscribe("kobuki/data") mqtt_client.on_message = on_message # this lines needs to be under the function definition otherwise it cant find which function it needs to use