Sens_Temp_Umid_LCD

Dependencies:   mbed DHT TextLCD

Files at this revision

API Documentation at this revision

Comitter:
luigi_lagatta
Date:
Thu Apr 04 13:40:50 2019 +0000
Parent:
2:4f9613cebdae
Commit message:
Sensore_Temp_Umid_LCD

Changed in this revision

TextLCD.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 4f9613cebdae -r 0b0d2e449123 TextLCD.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Thu Apr 04 13:40:50 2019 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/TextLCD/#e4cb7ddee0d3
diff -r 4f9613cebdae -r 0b0d2e449123 main.cpp
--- a/main.cpp	Mon Nov 27 05:24:09 2017 +0000
+++ b/main.cpp	Thu Apr 04 13:40:50 2019 +0000
@@ -1,8 +1,10 @@
 #include "mbed.h"
 #include "DHT.h"
+#include "TextLCD.h"
+#define   DHT_DATA_PIN  D7
 
-#define   DHT_DATA_PIN  D4
- Serial out(USBTX,USBRX);
+TextLCD lcd(D10,D11,D5,D4,D3,D2); // rs, e, d4-d7
+Serial out(USBTX,USBRX);
 DHT sensor(DHT_DATA_PIN, DHT11);                    //DHT(PinName pin, eType DHTtype)
  
 int main()
@@ -10,7 +12,7 @@
     int error = 0;
     float h = 0.0f, c = 0.0f, f = 0.0f, k = 0.0f, dp = 0.0f, dpf = 0.0f;
  
-    while(1) 
+  //  while(1) 
     {
         wait(2.0f);                                 //wait 2 second
         error = sensor.readData(); 
@@ -22,8 +24,11 @@
             f   = sensor.ReadTemperature(FARENHEIT);
             k   = sensor.ReadTemperature(KELVIN);
             h   = sensor.ReadHumidity();
-            dp  = sensor.CalcdewPoint(c, h);
-            dpf = sensor.CalcdewPointFast(c, h);
+            //dp  = sensor.CalcdewPoint(c, h);
+            //dpf = sensor.CalcdewPointFast(c, h);
+            lcd.printf("Temp: %4.1f C \n", c);
+            lcd.printf("Umid: %4.1f \n", 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);
         }