From bbec17e15eb3bb5c4948a5043777f75f65fbf72e Mon Sep 17 00:00:00 2001 From: Zachary Nisen Date: Wed, 3 Jun 2026 14:57:30 -0600 Subject: [PATCH] Added CSV logging --- menu.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/menu.py b/menu.py index fd378dc..66d78d5 100644 --- a/menu.py +++ b/menu.py @@ -1,4 +1,5 @@ import logging +import csv import obd logging.getLogger("obd").setLevel(logging.CRITICAL) @@ -90,6 +91,17 @@ def vehicle_info(connection): pause() +def save_log(): + with open("vehicle_log.csv", "w", newline="") as file: + writer = csv.writer(file) + + writer.writerow(["RPM", "Speed", "Coolant"]) + writer.writerow([850, 0, 195]) + + print("Log saved to vehicle_log.csv") + pause() + + def main(): connection = None @@ -105,6 +117,7 @@ def main(): print("2. Read Codes") print("3. Live Data") print("4. Vehicle Info") + print("5. Save vehicle log") print("Q. Quit") choice = input("> ") @@ -121,11 +134,13 @@ def main(): elif choice == "4": vehicle_info(connection) + elif choice == "5": + save_log() + elif choice.lower() == "q": break else: print("Invalid choice") - main()