From 167ff9584c47509fb5223cd5160dba280e593e19 Mon Sep 17 00:00:00 2001 From: Thijs Driessen Date: Wed, 3 Dec 2025 15:34:27 +0100 Subject: [PATCH] Not yet working implementation --- .idea/A.K.03.iml | 2 +- .idea/misc.xml | 2 +- student_code/dist_func.py | 5 +++-- student_code/dist_obj.py | 2 +- student_code/ui.py | 7 ++++--- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.idea/A.K.03.iml b/.idea/A.K.03.iml index 7133e2f..c56ca50 100644 --- a/.idea/A.K.03.iml +++ b/.idea/A.K.03.iml @@ -4,7 +4,7 @@ - + diff --git a/.idea/misc.xml b/.idea/misc.xml index f42a977..822c310 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,5 +3,5 @@ - + \ No newline at end of file diff --git a/student_code/dist_func.py b/student_code/dist_func.py index 44b7222..b36df8f 100644 --- a/student_code/dist_func.py +++ b/student_code/dist_func.py @@ -1,12 +1,13 @@ import time from kitt import KITT -def process(recording_duration): +# recording_duration +def process(): # Record data for a specified duration (e.g., 10 seconds) start_time = time.time() - while time.time() - start_time < recording_duration: + while time.time() - start_time < 10: status = KITT.get_distance_report() lines = status.splitlines() diff --git a/student_code/dist_obj.py b/student_code/dist_obj.py index 0075816..f3b57b6 100644 --- a/student_code/dist_obj.py +++ b/student_code/dist_obj.py @@ -5,7 +5,7 @@ class DistanceSensor: data = [] def __init__(self, data): - self.data = data0 + self.data = data def process(self, recording_duration): diff --git a/student_code/ui.py b/student_code/ui.py index effe64b..bf6b348 100644 --- a/student_code/ui.py +++ b/student_code/ui.py @@ -94,16 +94,17 @@ if __name__ == "__main__": # Distance sensor - sensor_label = tk.Label(root, text=f"Speed {dist_func.process(rec_time_var)}") + sensor_label = tk.Label(root, text=f"Speed {dist_func.process()}") sensor_label.grid(row=0, column=0) sensor_var = tk.StringVar() sensor_entry = tk.Entry(root, textvariable=sensor_var) sensor_entry.grid(row=0, column=1) + # rec_time_var.get() def sensor_btn(): - dist_func.process(rec_time_var) - sensor_label.config(text=f"Speed {dist_func.process(rec_time_var)}") + dist_func.process() + sensor_label.config(text=f"Speed {dist_func.process()}") sensor_set_btn = tk.Button(root, text="Request Sensor Reading", command=sensor_btn) sensor_set_btn.grid(row=0, column=2)