This commit is contained in:
2025-11-13 11:36:45 +01:00
commit fc6dc3ce77
7 changed files with 380 additions and 0 deletions

23
database.py Normal file
View File

@@ -0,0 +1,23 @@
import sqlite3
import os
DB_PATH = "/sd/bordcomputer.db"
def init_db():
if not os.path.exists(DB_PATH):
conn = sqlite3.connect(DB_PATH)
c = conn.cursor()
c.execute('''
CREATE TABLE IF NOT EXISTS sensors (
id INTEGER PRIMARY KEY AUTOINCREMENT,
timestamp TEXT,
oil_temp REAL,
speed REAL,
latitude REAL,
longitude REAL,
distance REAL
)
''')
conn.commit()
conn.close()
print("Database created")