Récupérer la température en Celsius et le pourcentage d'humidité dans l'air grace au capteur DHT11

Dependencies:   DHT11 mbed

Files at this revision

API Documentation at this revision

Comitter:
dalleo
Date:
Mon Mar 13 16:14:18 2017 +0000
Commit message:
Suppression des led de debug et des option d'affichage ;

Changed in this revision

DHT11.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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 8623c31b9888 DHT11.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DHT11.lib	Mon Mar 13 16:14:18 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/s_inoue_mbed/code/DHT11/#e91c151d1798
diff -r 000000000000 -r 8623c31b9888 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Mar 13 16:14:18 2017 +0000
@@ -0,0 +1,27 @@
+/*
+ * A program for the use of the DHT11, a temperature and humidity sensor
+ * Shigenori Inoue, September 10, 2014
+ */
+ 
+#include "mbed.h"
+#include "DHT11.h"
+
+// Humidity sensor
+DHT11 d(D6);
+
+// The main function
+int main()
+{
+    int state;
+    while(true) {
+        state = d.readData();
+
+        if (state != DHT11::OK) {
+             printf("Error: %d", state);
+        } else {
+             printf("Temp=%d \n\rHumi=%d \n\r", d.readTemperature(), d.readHumidity());
+        }
+        wait(2.0);
+    }
+}
+
diff -r 000000000000 -r 8623c31b9888 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Mar 13 16:14:18 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/176b8275d35d
\ No newline at end of file