I am attempting to create a program that reads 3 sensors from a raspberry pi sense hat, and insert those values into a sql database, using python. When I execute the program, no errors are given, but when I try to select the data using python, or even going into the database itself, the data is nowhere to be found, I believe the data isn't being properly written. How would I go about correcting this?
import sqlite3
import datetime
from sense_hat import SenseHat
sense = SenseHat()
sensePressure = int(sense.get_pressure())
senseTemp = int(sense.get_temperature() * 1.8 + 32 - 18.85)
senseHumidity = int(sense.get_humidity())
currDateTime = datetime.datetime.now()
COUNT = 1
conn = sqlite3.connect('sense.db')
c = conn.cursor()
c.execute("INSERT INTO atmos (ITEM, DATETIME, TEMPERATURE, HUMIDITY, PRESSURE) VALUES (?, ?, ?, ?,
?)", (COUNT, currDateTime, senseTemp, sensePressure, senseHumidity))
conn.commit()
conn.close()