Y SI
/
lib_SHT25_example
example for SHT25 humidity and temperature sensor
main.cpp@7:d72c18c3ccca, 2021-10-06 (annotated)
- Committer:
- YSI
- Date:
- Wed Oct 06 13:41:21 2021 +0000
- Revision:
- 7:d72c18c3ccca
- Parent:
- 3:d20d2edb61cb
simplify
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
YSI | 0:885179b0efef | 1 | #include "lib_SHT25.h" |
YSI | 0:885179b0efef | 2 | |
YSI | 1:e13ad6081cb3 | 3 | SHT25 sensor(I2C_SDA, I2C_SCL); |
YSI | 0:885179b0efef | 4 | |
YSI | 0:885179b0efef | 5 | int main() |
YSI | 0:885179b0efef | 6 | { |
YSI | 0:885179b0efef | 7 | while(1) |
YSI | 0:885179b0efef | 8 | { |
YSI | 7:d72c18c3ccca | 9 | sensor.waitSafeHeat(); |
YSI | 7:d72c18c3ccca | 10 | float temperature = sensor.getTemperature(), humidity = sensor.getHumidity(); |
YSI | 7:d72c18c3ccca | 11 | printf("\r\ntemperature = %6.2f%cC -|- humidity = %6.2f%%RH", temperature, 248, humidity); |
YSI | 1:e13ad6081cb3 | 12 | sensor.waitSafeHeat(); |
YSI | 0:885179b0efef | 13 | sensor.getData(&temperature, &humidity); |
YSI | 7:d72c18c3ccca | 14 | printf("\r\ntemperature = %6.2f%cC -|- humidity = %6.2f%%RH", temperature, 248, humidity); |
YSI | 0:885179b0efef | 15 | } |
YSI | 0:885179b0efef | 16 | } |