![](/media/cache/profiles/23d2018fbeae92114a4f4ff189549215.jpg.50x50_q85.png)
DHT-11 Tested Working
Revision 0:6e5d3c6e8715, committed 2014-03-03
- Comitter:
- umairaftab
- Date:
- Mon Mar 03 19:57:32 2014 +0000
- Commit message:
- working ;
Changed in this revision
diff -r 000000000000 -r 6e5d3c6e8715 DHT.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DHT.lib Mon Mar 03 19:57:32 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/Wimpie/code/DHT/#9b5b3200688f
diff -r 000000000000 -r 6e5d3c6e8715 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Mar 03 19:57:32 2014 +0000 @@ -0,0 +1,28 @@ +#include "mbed.h" +#include "DHT.h" + +DigitalOut myled(LED1); + +DHT sensor(PTD4,SEN11301P); // Use the SEN11301P sensor + +int main() { + int err; + printf("\r\nDHT Test program"); + printf("\r\n******************\r\n"); + wait(1); // wait 1 second for device stable status + while (1) { + myled = 1; + err = sensor.readData(); + if (err == 0) { + printf("Temperature is %4.2f C \r\n",sensor.ReadTemperature(CELCIUS)); + printf("Temperature is %4.2f F \r\n",sensor.ReadTemperature(FARENHEIT)); + printf("Temperature is %4.2f K \r\n",sensor.ReadTemperature(KELVIN)); + printf("Humidity is %4.2f \r\n",sensor.ReadHumidity()); + printf("Dew point is %4.2f \r\n",sensor.CalcdewPoint(sensor.ReadTemperature(CELCIUS), sensor.ReadHumidity())); + printf("Dew point (fast) is %4.2f \r\n",sensor.CalcdewPointFast(sensor.ReadTemperature(CELCIUS), sensor.ReadHumidity())); + } else + printf("\r\nErr %i \n",err); + myled = 0; + wait(15); + } +} \ No newline at end of file
diff -r 000000000000 -r 6e5d3c6e8715 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Mar 03 19:57:32 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/869cf507173a \ No newline at end of file