mirror of
https://gitlab.fdmci.hva.nl/technische-informatica-sm3/ti-projectten/rooziinuubii79.git
synced 2025-08-03 20:04:58 +00:00
changed db send data to other function
This commit is contained in:
@@ -60,8 +60,16 @@ def control():
|
|||||||
|
|
||||||
@app.route('/data', methods=['GET'])
|
@app.route('/data', methods=['GET'])
|
||||||
def data():
|
def 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()
|
||||||
return kobuki_message
|
return kobuki_message
|
||||||
|
|
||||||
|
|
||||||
@app.route('/move', methods=['POST'])
|
@app.route('/move', methods=['POST'])
|
||||||
def move():
|
def move():
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
@@ -91,14 +99,6 @@ def database():
|
|||||||
cursor.close()
|
cursor.close()
|
||||||
return str(rows)
|
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__':
|
if __name__ == '__main__':
|
||||||
app.run(debug=True, port=5000)
|
app.run(debug=True, port=5000)
|
||||||
|
Reference in New Issue
Block a user