mirror of
https://gitlab.fdmci.hva.nl/technische-informatica-sm3/ti-projectten/rooziinuubii79.git
synced 2025-08-03 20:04:58 +00:00
feat: add save_sensor_data function to insert sensor data into the database
This commit is contained in:
@@ -90,5 +90,14 @@ def database():
|
||||
cursor.close()
|
||||
return str(rows)
|
||||
|
||||
def save_sensor_data(data):
|
||||
db = get_db()
|
||||
cursor = db.cursor()
|
||||
sql = "INSERT INTO kobuki_data (data) VALUES (%s)"
|
||||
value = data
|
||||
cursor.execute(sql, (value,))
|
||||
db.commit()
|
||||
cursor.close()
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True, port=5000)
|
||||
|
Reference in New Issue
Block a user