Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of TH02_humidity_temp by
main.cpp
00001 #include "mbed.h" 00002 00003 #include "th02.h" 00004 00005 00006 00007 //DigitalOut myled(LED1); 00008 00009 00010 TH02 MyTH02 (I2C_SDA,I2C_SCL,TH02_I2C_ADDR<<1);// connect hsensor on RX2 TX2 00011 //TH02 MyTH02 (p28,p27,TH02_I2C_ADDR<<1);// connect hsensor on RX2 TX2 00012 00013 int main() { 00014 int iTemp,iTime,iTempbrute,iRH,iRHbrute; 00015 printf ("\n\r start reading TH02"); 00016 //MyTH02.startTempConv(true,true); 00017 00018 MyTH02.startTempConv(true,true); 00019 iTime= MyTH02.waitEndConversion();// wait until onversion is done 00020 printf ("\n\r time=%d",iTime); 00021 00022 00023 while(1) { 00024 00025 MyTH02.startTempConv(true,true); 00026 iTime= MyTH02.waitEndConversion();// wait until onversion is done 00027 iTempbrute= MyTH02.getConversionValue(); 00028 iTemp=MyTH02.getLastRawTemp(); 00029 printf ("\n\r temp value=%d %d",iTemp,iTempbrute ); 00030 00031 00032 MyTH02.startRHConv(true,true); 00033 iTime= MyTH02.waitEndConversion();// wait until onversion is done 00034 printf ("\n\r time=%d",iTime); 00035 iRHbrute= MyTH02.getConversionValue(); 00036 iRH=MyTH02.getLastRawRH(); 00037 printf ("\n\r RH value=%d %d",iRH,iRHbrute ); 00038 00039 00040 wait_ms(100); 00041 00042 00043 00044 00045 } 00046 }
Generated on Sat Jul 16 2022 23:02:48 by
