Y SI
/
lib_SHT25_example
example for SHT25 humidity and temperature sensor
Diff: main.cpp
- Revision:
- 1:e13ad6081cb3
- Parent:
- 0:885179b0efef
- Child:
- 2:3d0d54bad359
--- a/main.cpp Mon Jun 18 08:10:51 2018 +0000 +++ b/main.cpp Tue Dec 11 13:10:27 2018 +0000 @@ -2,15 +2,19 @@ #include "lib_SHT25.h" Serial pc(USBTX, USBRX); -SHT25 sensor(p28, p27); +SHT25 sensor(I2C_SDA, I2C_SCL); int main() { float temperature, humidity; while(1) { + temperature = sensor.getTemperature(); + humidity = sensor.getTemperature(); + pc.printf("\r\ntemperature = %6.2f%cC -|- humidity = %6.2f%%RH", temperature, 248, humidity); + sensor.waitSafeHeat(); sensor.getData(&temperature, &humidity); - pc.printf("\rtemperature = %6.2f%cC -|- humidity = %6.2f%%RH", temperature, 248, humidity); - wait(0.5); + pc.printf("\ntemperature = %6.2f%cC -|- humidity = %6.2f%%RH", temperature, 248, humidity); + sensor.waitSafeHeat(); } } \ No newline at end of file