From 4559850b4a302ca6a62af468152c49bfa46b030d Mon Sep 17 00:00:00 2001 From: Andreas Gattringer <andreas.gattringer@univie.ac.at> Date: Thu, 28 Mar 2024 14:21:35 +0100 Subject: [PATCH] rhtp.py: update and simplify --- programs/rhtp.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/programs/rhtp.py b/programs/rhtp.py index cadc4e4..eb18bb0 100644 --- a/programs/rhtp.py +++ b/programs/rhtp.py @@ -1,6 +1,5 @@ import sys -from umnp.microcontroller.measurementdevice import MeasurementDevice from umnp.microcontroller.sensors.lps28dfw import LPS28DFW from umnp.microcontroller.sensors.sht45 import SHT45 @@ -15,22 +14,20 @@ else: async def main(): - # configure network - device = MeasurementDevice() i2c = machine.I2C(id=1, scl=machine.Pin(27), sda=machine.Pin(26)) sht45 = SHT45(i2c) p_sensor = LPS28DFW(i2c) while True: t, rh = await sht45.measure() - p = await p_sensor.pressure() - p_t = await p_sensor.temperature() + p, p_t = await p_sensor.measure() + print(f"temperature: {t}") print(f"rH: {rh}") print(f"pressure: {p}") print(f"temperature (p): {p_t}") print() print() - asyncio.sleep(1) + await asyncio.sleep(1) if __name__ == "__main__": -- GitLab