Y SI
/
lib_SHT25_example
example for SHT25 humidity and temperature sensor
main.cpp@0:885179b0efef, 2018-06-18 (annotated)
- Committer:
- YSI
- Date:
- Mon Jun 18 08:10:51 2018 +0000
- Revision:
- 0:885179b0efef
- Child:
- 1:e13ad6081cb3
example for SHT25 humidity and temperature sensor
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 | 0:885179b0efef | 5 | SHT25 sensor(p28, p27); |
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 | 0:885179b0efef | 12 | sensor.getData(&temperature, &humidity); |
YSI | 0:885179b0efef | 13 | pc.printf("\rtemperature = %6.2f%cC -|- humidity = %6.2f%%RH", temperature, 248, humidity); |
YSI | 0:885179b0efef | 14 | wait(0.5); |
YSI | 0:885179b0efef | 15 | } |
YSI | 0:885179b0efef | 16 | } |