Tester for DHT22

Dependencies:   DHT mbed

Files at this revision

API Documentation at this revision

Comitter:
gert_lauritsen
Date:
Fri Feb 26 20:38:20 2016 +0000
Parent:
1:781c47971406
Commit message:
Test til dht22

Changed in this revision

DHT.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 781c47971406 -r 97f36e93b6e6 DHT.lib
--- a/DHT.lib	Wed Feb 24 08:36:25 2016 +0000
+++ b/DHT.lib	Fri Feb 26 20:38:20 2016 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/users/Wimpie/code/DHT/#6ddabfde1db6
+https://developer.mbed.org/teams/Skovbrynet/code/DHT/#a106059dae56
diff -r 781c47971406 -r 97f36e93b6e6 main.cpp
--- a/main.cpp	Wed Feb 24 08:36:25 2016 +0000
+++ b/main.cpp	Fri Feb 26 20:38:20 2016 +0000
@@ -3,7 +3,8 @@
 
 
 DigitalOut myled(LED1);
-DHT dht22(A2,DHT22);  
+DigitalOut Error(LED2);
+DHT dht22(p21,DHT22);  
 
 int main() {
     printf("Starting!!!\r\n");
@@ -11,13 +12,18 @@
     while(1) {
        int err=dht22.readData();
        if (err==0) {
+          Error=0; 
           printf("T: %.1f C",dht22.ReadTemperature(CELCIUS));
           printf(" H %.1f\% \n\r",dht22.ReadHumidity());
        }
+       else {
+         Error=1;
+         dht22.printErr(err);
+       }  
 
         myled = 1;
-        wait(2);
+        wait(3);
         myled = 0;
-        wait(0.2);
+
     }
 }