From 91a8700b8e3633b31963876b6be6b5dfd71a25b8 Mon Sep 17 00:00:00 2001 From: Maximilian Giller Date: Mon, 9 Oct 2023 18:10:13 +0200 Subject: [PATCH] Added simple test-measuring script --- src/measurer.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/measurer.py diff --git a/src/measurer.py b/src/measurer.py new file mode 100644 index 0000000..ecb535b --- /dev/null +++ b/src/measurer.py @@ -0,0 +1,23 @@ +from src.sensors.tof_sensor import Directions +from sensors.vl53l1x_sensor import VL53L1XSensor +from time import sleep +import logging + + +DELAY_SECONDS = 1 + + +sensor = VL53L1XSensor() + +while True: + sensor.setDirection(Directions.INSIDE) + distance_inside = sensor.getDistance() + + sensor.setDirection(Directions.OUTSIDE) + distance_outside = sensor.getDistance() + + logging.info(f"----------\nInside: {distance_inside} cm") + logging.info(f"Outside: {distance_outside} cm") + + sleep(DELAY_SECONDS) +