Embedded for 11U68 DHT LCD Sensor Demo

Dependencies:   DHT TextLCD mbed

Fork of TextLCD_HelloWorld by Simon Ford

Revision:
3:ad558d3aaa98
Parent:
2:ad0b044d0a10
--- a/main.cpp	Sat Dec 04 11:31:07 2010 +0000
+++ b/main.cpp	Tue Jul 21 08:02:46 2015 +0000
@@ -1,10 +1,36 @@
-// Hello World! for the TextLCD
-
+/*TextLCD indicate RHT sensor
+LCD::LinkMan TC1602E-25A 
+RHT sensor::DHT11
+Main board::Embedded for 11U68 HAPI-Tech-Solution,Inc
+Shiled::Arduino Universal shiled P-06877
+*/
 #include "mbed.h"
 #include "TextLCD.h"
-
-TextLCD lcd(p15, p16, p17, p18, p19, p20); // rs, e, d4-d7
+#include "DHT.h"
+DHT sensor(P1_25,SEN11301P); // Use the SEN11301P sensor
+TextLCD lcd(P1_28, P2_3, P0_2, P0_9, P0_8, P1_29,TextLCD::LCD16x2); // rs, e, d4-d7
 
 int main() {
-    lcd.printf("Hello World!\n");
+    int err;
+    lcd.locate(0,0);
+    lcd.printf("DHT Test program\n");
+    wait(1); // wait 1 second for device stable status
+    while (1) {
+        err = sensor.readData();
+        if (err == 0) {
+            lcd.locate(0,0);
+            lcd.printf("Room Temp:%4.2f C\n",sensor.ReadTemperature(CELCIUS));
+            lcd.locate(0,1);
+            lcd.printf("Room RH%:%4.2f %\n",sensor.ReadHumidity());
+            wait_ms(1500);
+            lcd.cls();
+            lcd.locate(0,0);
+            lcd.printf("Dew point is %4.2f \n",sensor.CalcdewPoint(sensor.ReadTemperature(CELCIUS), sensor.ReadHumidity()));
+            wait_ms(1500);
+            lcd.cls();
+        }else if (err != 0); 
+            lcd.locate(0,0);
+            lcd.printf("Err %i \n",err);
+        wait(1);
+    }
 }