Exemplo n.º 1
0
def update_fuel_value(fuel_value):
    value_set = []
    value_set.append(fuel_value)
    mysql_cur = mysql_db.get_cursor()
    query = "UPDATE `vehicle_data` SET `FuelLevel` = %s WHERE VehicleID = 'KA53MB6956'"
    mysql_cur.execute(query, value_set)
    mysql_db.commit_data()
Exemplo n.º 2
0
mysql_db.open_connection()

# do 5 times to initialize
i = 0
while i<5:
    sensor_readings = sensor_data.get_sense_data()
    i = i+1

print("loop start")
i=0
start_time = time.time()
now = time.time()

while now < start_time + time_to_log:

    sensor_readings = sensor_data.get_sense_data()
    sensor_readings.append(comment)

    mysql_db.write_sensor_data_to_local_db(sensor_readings)

    now = time.time()

    i=i+1
    if i%commit_frequency == 0:
        mysql_db.commit_data()

# Commit and Close connection
mysql_db.close_connection()

print("program complete")