dht11

Dependencies:   DHT mbed

Fork of DHT-11 by Umair Aftab

Files at this revision

API Documentation at this revision

Comitter:
lanmaomao7
Date:
Wed Apr 09 20:11:10 2014 +0000
Parent:
0:6e5d3c6e8715
Commit message:
dht11

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 6e5d3c6e8715 -r d9be5eb8bdeb main.cpp
--- a/main.cpp	Mon Mar 03 19:57:32 2014 +0000
+++ b/main.cpp	Wed Apr 09 20:11:10 2014 +0000
@@ -3,7 +3,7 @@
  
 DigitalOut myled(LED1);
  
-DHT sensor(PTD4,SEN11301P); // Use the SEN11301P sensor
+DHT sensor(PTC7,SEN11301P); // Use the SEN11301P sensor
  
 int main() {
     int err;
@@ -25,4 +25,28 @@
         myled = 0;
         wait(15);
     }
+}
+float Humidity_Sensor_Temperature(){
+        int err;
+        wait(1);
+        err = sensor.readData();
+        if (err == 0) 
+            return sensor.ReadTemperature(CELCIUS);
+        else return err;
+}
+float Humidity_Sensor_Humidity(){
+        int err;
+        wait(1);
+        err = sensor.readData();
+        if (err == 0) 
+            return sensor.ReadHumidity();
+        else return err;
+}
+float Humidity_Sensor_Dewpoint(){
+        int err;
+        wait(1);
+        err = sensor.readData();
+        if (err == 0) 
+            return sensor.CalcdewPoint(sensor.ReadTemperature(CELCIUS), sensor.ReadHumidity());
+        else return err;
 }
\ No newline at end of file