DHT11

Dependencies:   mbed mbed-rtos SDFileSystem EthernetInterface DHT11

Revision:
2:44f331aea307
Parent:
1:baaf95f8d272
Child:
3:b2eae813c2e1
--- a/main.cpp	Tue Nov 13 11:46:10 2018 +0000
+++ b/main.cpp	Sat Nov 24 22:20:03 2018 +0000
@@ -3,6 +3,7 @@
 #include "EthernetInterface.h"
 #include <iostream>
 #include <fstream>
+#include "DHT11.h"
 
 #define NUMBER_OF_LINES     23
 #define COLOR_LINE          12
@@ -16,6 +17,22 @@
 Serial pc(USBTX, USBRX);
 string file_content[NUMBER_OF_LINES];
 
+
+DHT11 d(PTD1);
+
+void DHT11_read()
+  {
+      int s;
+      s = d.readData();
+      if (s != DHT11::OK) {
+          pc.printf("Error!\r\n");
+      }
+      else {
+          pc.printf("T:%d, H:%d\r\n", d.readTemperature(), d.readHumidity());
+      }
+  }
+
+
 void initializeEthernet(void)
 {
     EthernetInterface eth;