Y SI
/
lib_SHT25_example
example for SHT25 humidity and temperature sensor
main.cpp@2:3d0d54bad359, 2019-05-29 (annotated)
- Committer:
- YSI
- Date:
- Wed May 29 13:37:26 2019 +0000
- Revision:
- 2:3d0d54bad359
- Parent:
- 1:e13ad6081cb3
- Child:
- 3:d20d2edb61cb
getTemperature change by getHumidity
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
YSI | 0:885179b0efef | 1 | #include "mbed.h" |
YSI | 0:885179b0efef | 2 | #include "lib_SHT25.h" |
YSI | 0:885179b0efef | 3 | |
YSI | 0:885179b0efef | 4 | Serial pc(USBTX, USBRX); |
YSI | 1:e13ad6081cb3 | 5 | SHT25 sensor(I2C_SDA, I2C_SCL); |
YSI | 0:885179b0efef | 6 | |
YSI | 0:885179b0efef | 7 | int main() |
YSI | 0:885179b0efef | 8 | { |
YSI | 0:885179b0efef | 9 | float temperature, humidity; |
YSI | 0:885179b0efef | 10 | while(1) |
YSI | 0:885179b0efef | 11 | { |
YSI | 1:e13ad6081cb3 | 12 | temperature = sensor.getTemperature(); |
YSI | 2:3d0d54bad359 | 13 | humidity = sensor.getHumidity(); |
YSI | 1:e13ad6081cb3 | 14 | pc.printf("\r\ntemperature = %6.2f%cC -|- humidity = %6.2f%%RH", temperature, 248, humidity); |
YSI | 1:e13ad6081cb3 | 15 | sensor.waitSafeHeat(); |
YSI | 0:885179b0efef | 16 | sensor.getData(&temperature, &humidity); |
YSI | 2:3d0d54bad359 | 17 | pc.printf("\r\ntemperature = %6.2f%cC -|- humidity = %6.2f%%RH", temperature, 248, humidity); |
YSI | 1:e13ad6081cb3 | 18 | sensor.waitSafeHeat(); |
YSI | 0:885179b0efef | 19 | } |
YSI | 0:885179b0efef | 20 | } |