mirror of
https://gitlab.fdmci.hva.nl/technische-informatica-sm3/ti-projectten/rooziinuubii79.git
synced 2025-08-03 20:04:58 +00:00
changed mqtt port
This commit is contained in:
@@ -5,18 +5,20 @@ import mysql.connector
|
|||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
# Globale MQTT setup
|
# Globale MQTT setup
|
||||||
kobuki_message = "empty"
|
def on_message(client, message):
|
||||||
def on_message(client, userdata, message):
|
global kobuki_message, latest_image
|
||||||
global kobuki_message
|
if message.topic == "kobuki/data":
|
||||||
kobuki_message = str(message.payload.decode("utf-8"))
|
kobuki_message = str(message.payload.decode("utf-8"))
|
||||||
print(kobuki_message)
|
elif message.topic == "kobuki/cam":
|
||||||
|
latest_image = message.payload
|
||||||
|
|
||||||
|
|
||||||
|
# Create an MQTT client instance
|
||||||
mqtt_client = mqtt.Client()
|
mqtt_client = mqtt.Client()
|
||||||
mqtt_client.username_pw_set("server", "serverwachtwoordofzo")
|
mqtt_client.username_pw_set("server", "serverwachtwoordofzo")
|
||||||
mqtt_client.connect("localhost", 80, 60)
|
mqtt_client.connect("localhost", 1884, 60)
|
||||||
mqtt_client.loop_start()
|
mqtt_client.loop_start()
|
||||||
mqtt_client.subscribe("kobuki/data")
|
mqtt_client.subscribe("kobuki/data")
|
||||||
mqtt_client.on_message = on_message
|
|
||||||
|
|
||||||
# Database connectie-functie
|
# Database connectie-functie
|
||||||
def get_db():
|
def get_db():
|
||||||
|
Reference in New Issue
Block a user