Drivers and example program

Dependencies:   DHT mbed

Fork of Seeed_Grove_Temp_Humidity_Example by Seeed

Files at this revision

API Documentation at this revision

Comitter:
alex0612
Date:
Fri Nov 06 16:38:49 2015 +0000
Parent:
1:6bcb143683f3
Commit message:
driver and example code

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 6bcb143683f3 -r 5f336f6ec4d5 main.cpp
--- a/main.cpp	Tue Mar 10 21:33:31 2015 +0000
+++ b/main.cpp	Fri Nov 06 16:38:49 2015 +0000
@@ -3,6 +3,8 @@
 #include "DHT.h"
 
 DHT sensor(D4, DHT11);
+DigitalOut myled(LED1);
+Serial pc(USBTX, USBRX); // tx, rx
 
 int main()
 {
@@ -19,10 +21,10 @@
             h   = sensor.ReadHumidity();
             dp  = sensor.CalcdewPoint(c, h);
             dpf = sensor.CalcdewPointFast(c, h);
-            printf("Temperature in Kelvin: %4.2f, Celcius: %4.2f, Farenheit %4.2f\n", k, c, f);
-            printf("Humidity is %4.2f, Dewpoint: %4.2f, Dewpoint fast: %4.2f\n", h, dp, dpf);
+            pc.printf("Temperature in Kelvin: %4.2f, Celcius: %4.2f, Farenheit %4.2f\n", k, c, f);
+            pc.printf("Humidity is %4.2f, Dewpoint: %4.2f, Dewpoint fast: %4.2f\n", h, dp, dpf);
         } else {
-            printf("Error: %d\n", error);
+            pc.printf("Error: %d\n", error);
         }
     }
 }