Y SI
/
lib_SHT25_example
example for SHT25 humidity and temperature sensor
Revision 7:d72c18c3ccca, committed 2021-10-06
- Comitter:
- YSI
- Date:
- Wed Oct 06 13:41:21 2021 +0000
- Parent:
- 6:e0e56926d406
- Commit message:
- simplify
Changed in this revision
lib_SHT25.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r e0e56926d406 -r d72c18c3ccca lib_SHT25.lib --- a/lib_SHT25.lib Wed Sep 22 13:26:11 2021 +0000 +++ b/lib_SHT25.lib Wed Oct 06 13:41:21 2021 +0000 @@ -1,1 +1,1 @@ -https://os.mbed.com/users/YSI/code/lib_SHT25/#bb3dbc86a180 +https://os.mbed.com/users/YSI/code/lib_SHT25/#382955a266cb
diff -r e0e56926d406 -r d72c18c3ccca main.cpp --- 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