example for SHT25 humidity and temperature sensor

Dependencies:   mbed lib_SHT25

Revision:
7:d72c18c3ccca
Parent:
3:d20d2edb61cb
--- a/main.cpp	Wed Sep 22 13:26:11 2021 +0000
+++ b/main.cpp	Wed Oct 06 13:41:21 2021 +0000
@@ -1,19 +1,16 @@
 #include "lib_SHT25.h"
  
-Serial pc(USBTX, USBRX);
 SHT25  sensor(I2C_SDA, I2C_SCL);
 
 int main()
 {
-    float temperature, humidity;
     while(1)
     {
-        temperature = sensor.getTemperature();
-        humidity = sensor.getHumidity();
-        pc.printf("\r\ntemperature = %6.2f%cC -|- humidity = %6.2f%%RH", temperature, 248, humidity);
+        sensor.waitSafeHeat();
+        float temperature = sensor.getTemperature(), humidity = sensor.getHumidity();
+        printf("\r\ntemperature = %6.2f%cC -|- humidity = %6.2f%%RH", temperature, 248, humidity);
         sensor.waitSafeHeat();
         sensor.getData(&temperature, &humidity);
-        pc.printf("\r\ntemperature = %6.2f%cC -|- humidity = %6.2f%%RH", temperature, 248, humidity);
-        sensor.waitSafeHeat();
+        printf("\r\ntemperature = %6.2f%cC -|- humidity = %6.2f%%RH", temperature, 248, humidity);
     }
 }
\ No newline at end of file