went back

This commit is contained in:
ishak jmilou.ishak
2025-01-14 13:14:38 +01:00
parent 74d9687af5
commit 2fbe18be76

View File

@@ -111,9 +111,6 @@ def move():
@app.route('/data', methods=['GET'])
def data():
return kobuki_message
def sensor_data(kobuki_message):
try:
# Parse de JSON-string naar een Python-dictionary
data = json.loads(kobuki_message)
@@ -133,7 +130,7 @@ def sensor_data(kobuki_message):
# Database-insert
db = get_db()
cursor = db.cursor()
with db.cursor() as cursor:
# Zorg dat je tabel `kobuki_data` kolommen heeft: `name` en `value`
sql_sensor = "INSERT INTO kobuki_data (name, value) VALUES (%s, %s)"
@@ -146,6 +143,8 @@ def sensor_data(kobuki_message):
print(f"JSON decode error: {e}")
except mysql.connector.Error as err:
print(f"Database error: {err}")
return kobuki_message
@app.route('/image')