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.
main.cpp
00001 #include "mbed.h" 00002 #include "DHT11.h" 00003 00004 DHT11 sensor(D4); 00005 00006 00007 00008 //--------------- 00009 int main() 00010 { 00011 //serial config 00012 Serial serial(PA_0,PA_1); /*PA_0=A0=TX PA_1=A0=RX*/ 00013 serial.baud(9600); 00014 serial.format(8,SerialBase::None,1); 00015 serial.printf("\r\nDHT Test program"); 00016 serial.printf("\r\n****************\r\n"); 00017 //char tmp[30];//="AT$SS=00 12 FF 42 \r\n";//$SS 00018 00019 00020 while(1){ 00021 00022 int s,T,H; 00023 s = sensor.readData(); 00024 T=sensor.readTemperature(); 00025 H=sensor.readHumidity(); 00026 if (s != DHT11::OK) { 00027 serial.printf("Error!\r\n"); 00028 } 00029 else { 00030 serial.printf("AT$SS=%x%x\r\n", T,H); 00031 } 00032 00033 wait(60); 00034 } 00035 }
Generated on Sun Jul 17 2022 23:13:05 by
1.7.2