Balkrishna Wagle
/
mbed_dht11_MYBOARDCODE
DHT11 - P22
Revision 0:62fe467ea077, committed 2018-03-08
- Comitter:
- rajivwagle
- Date:
- Thu Mar 08 12:18:32 2018 +0000
- Commit message:
- DHT11
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DHT.lib Thu Mar 08 12:18:32 2018 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/Wimpie/code/DHT/#9b5b3200688f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Mar 08 12:18:32 2018 +0000 @@ -0,0 +1,28 @@ +#include "mbed.h" +#include "DHT.h" + +DigitalOut myled(LED1); +Serial pc(USBTX,USBRX); +DHT sensor(p22,DHT11); // Use the SEN11301P sensor + +int main() { + int err; + pc.printf("\r\nDHT Test program"); + pc.printf("\r\n******************\r\n"); + wait(1); // wait 1 second for device stable status + while (1) { + myled = 1; + err = sensor.readData(); + if (err == 0) { + pc.printf("Temperature is %4.2f C \r\n",sensor.ReadTemperature(CELCIUS)); + pc.printf("Temperature is %4.2f F \r\n",sensor.ReadTemperature(FARENHEIT)); + pc.printf("Temperature is %4.2f K \r\n",sensor.ReadTemperature(KELVIN)); + pc.printf("Humidity is %4.2f \r\n",sensor.ReadHumidity()); + pc.printf("Dew point is %4.2f \r\n",sensor.CalcdewPoint(sensor.ReadTemperature(CELCIUS), sensor.ReadHumidity())); + pc.printf("Dew point (fast) is %4.2f \r\n",sensor.CalcdewPointFast(sensor.ReadTemperature(CELCIUS), sensor.ReadHumidity())); + } else + pc.printf("\r\nErr %i \n",err); + myled = 0; + wait(100); + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Mar 08 12:18:32 2018 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/e7ca05fa8600 \ No newline at end of file