![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
corrected TH02 sample program
Dependencies: mbed
Fork of TH02_humidity_temp by
Diff: main.cpp
- Revision:
- 0:f1951c6c9187
- Child:
- 1:8326614f3037
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Mar 17 10:13:49 2017 +0000 @@ -0,0 +1,41 @@ +#include "mbed.h" +#include "th02.h" + + + +DigitalOut myled(LED1); + + +TH02 MyTH02 (p28,p27,TH02_I2C_ADDR<<1);// connect hsensor on RX2 TX2 + + +int main() { + int iTemp,iTime,iTempbrute,iRH,iRHbrute; + printf ("\n start reading TH02"); + //MyTH02.startTempConv(true,true); + + + + while(1) { + MyTH02.startTempConv(true,true); + iTime= MyTH02.waitEndConversion();// wait until onversion is done + printf ("\n time=%d",iTime); + iTempbrute= MyTH02.getConversionValue(); + iTemp=MyTH02.getLastRawTemp(); + printf ("\n temp value=%d %d",iTemp,iTempbrute ); + + MyTH02.startRHConv(true,true); + iTime= MyTH02.waitEndConversion();// wait until onversion is done + printf ("\n time=%d",iTime); + iRHbrute= MyTH02.getConversionValue(); + iRH=MyTH02.getLastRawRH(); + printf ("\n RH value=%d %d",iRH,iRHbrute ); + + + wait_ms(1000); + + + + + } +}