example for SHT25 humidity and temperature sensor

Dependencies:   mbed lib_SHT25

Committer:
YSI
Date:
Wed Jun 30 09:05:13 2021 +0000
Revision:
3:d20d2edb61cb
Parent:
2:3d0d54bad359
Child:
7:d72c18c3ccca
up lib

Who changed what in which revision?

UserRevisionLine numberNew contents of line
YSI 0:885179b0efef 1 #include "lib_SHT25.h"
YSI 0:885179b0efef 2
YSI 0:885179b0efef 3 Serial pc(USBTX, USBRX);
YSI 1:e13ad6081cb3 4 SHT25 sensor(I2C_SDA, I2C_SCL);
YSI 0:885179b0efef 5
YSI 0:885179b0efef 6 int main()
YSI 0:885179b0efef 7 {
YSI 0:885179b0efef 8 float temperature, humidity;
YSI 0:885179b0efef 9 while(1)
YSI 0:885179b0efef 10 {
YSI 1:e13ad6081cb3 11 temperature = sensor.getTemperature();
YSI 2:3d0d54bad359 12 humidity = sensor.getHumidity();
YSI 1:e13ad6081cb3 13 pc.printf("\r\ntemperature = %6.2f%cC -|- humidity = %6.2f%%RH", temperature, 248, humidity);
YSI 1:e13ad6081cb3 14 sensor.waitSafeHeat();
YSI 0:885179b0efef 15 sensor.getData(&temperature, &humidity);
YSI 2:3d0d54bad359 16 pc.printf("\r\ntemperature = %6.2f%cC -|- humidity = %6.2f%%RH", temperature, 248, humidity);
YSI 1:e13ad6081cb3 17 sensor.waitSafeHeat();
YSI 0:885179b0efef 18 }
YSI 0:885179b0efef 19 }