From c94c0ae45b6405bd7f8b2d248189cc42cde0b7fc Mon Sep 17 00:00:00 2001
From: Andreas Gattringer <gattringera@a772-cvl-ws23.biodiv.univie.ac.at>
Date: Mon, 15 Apr 2024 13:56:05 +0200
Subject: [PATCH] rhtp: updated to new addresses, kept copy with old values in
 -orig

---
 programs/rhtp-orig.py | 34 ++++++++++++++++++++++++++++++++++
 programs/rhtp.py      |  2 +-
 2 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 programs/rhtp-orig.py

diff --git a/programs/rhtp-orig.py b/programs/rhtp-orig.py
new file mode 100644
index 0000000..f6b2b30
--- /dev/null
+++ b/programs/rhtp-orig.py
@@ -0,0 +1,34 @@
+import sys
+
+from umnp.microcontroller.sensors.lps28dfw import LPS28DFW
+from umnp.microcontroller.sensors.sht45 import SHT45
+
+if sys.implementation.name == "micropython":
+    # noinspection PyUnresolvedReferences
+    import machine
+
+    # noinspection PyUnresolvedReferences
+    import uasyncio as asyncio
+else:
+    from umnp.microcontroller.umock import machine
+
+
+async def main():
+    i2c = machine.I2C(id=1, scl=machine.Pin(27), sda=machine.Pin(26))
+    sht45 = SHT45(i2c)
+    p_sensor = LPS28DFW(i2c, i2c_address=0x5C)
+    while True:
+        t, rh = await sht45.measure()
+        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()
+        await asyncio.sleep(1)
+
+
+if __name__ == "__main__":
+    asyncio.run(main())
diff --git a/programs/rhtp.py b/programs/rhtp.py
index eb18bb0..25f33a4 100644
--- a/programs/rhtp.py
+++ b/programs/rhtp.py
@@ -14,7 +14,7 @@ else:
 
 
 async def main():
-    i2c = machine.I2C(id=1, scl=machine.Pin(27), sda=machine.Pin(26))
+    i2c = machine.I2C(id=1, scl=machine.Pin(5), sda=machine.Pin(4))
     sht45 = SHT45(i2c)
     p_sensor = LPS28DFW(i2c)
     while True:
-- 
GitLab