mirror of
https://gitlab.fdmci.hva.nl/technische-informatica-sm3/ti-projectten/rooziinuubii79.git
synced 2025-08-04 04:14:58 +00:00
changed to 2 functions
This commit is contained in:
@@ -76,12 +76,6 @@ def move():
|
||||
cursor = db_connection.cursor()
|
||||
sql_command = "INSERT INTO command (command) VALUES (%s)"
|
||||
cursor.execute(sql_command, (direction,))
|
||||
|
||||
if kobuki_message:
|
||||
sql_sensor = "INSERT INTO kobuki_data (data) VALUES (%s)"
|
||||
sensor_data_tuples = [(name, value) for name, value in kobuki_message.items()]
|
||||
cursor.executemany(sql_sensor, sensor_data_tuples)
|
||||
|
||||
db_connection.commit()
|
||||
cursor.close()
|
||||
db_connection.close()
|
||||
@@ -97,6 +91,14 @@ def database():
|
||||
cursor.close()
|
||||
return str(rows)
|
||||
|
||||
def sensor_data():
|
||||
db = get_db()
|
||||
cursor = db.cursor()
|
||||
cursor.execute("SELECT * FROM kobuki_data")
|
||||
rows = cursor.fetchall()
|
||||
cursor.close()
|
||||
return str(rows)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True, port=5000)
|
||||
|
Reference in New Issue
Block a user