test

Dependencies:   DS3231 RHT03 TextLCD mbed

Fork of project by Jennares Yutthaseree

Revision:
0:894306d5cad7
Child:
1:ae97d85a47dd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri May 22 14:25:00 2015 +0000
@@ -0,0 +1,44 @@
+#include "mbed.h"
+#include "TextLCD.h"
+#include "DS3231.h"
+#include "RHT03.h"
+I2C i2c(D14,D15);
+TextLCD_I2C lcd(&i2c,0x4E,TextLCD::LCD16x2);
+DS3231 rtc(D14,D15);
+RHT03 rht(D13);
+
+int main()
+{
+    lcd.setMode(TextLCD::DispOn); 
+    lcd.setBacklight(TextLCD::LightOff);
+    lcd.setCursor(TextLCD::CurOff_BlkOff);
+    //rtc.setTime(20,58,00);
+    //rtc.setDate(5,22,5,2015);
+    float Temp,Hum;
+    int dw,d,M,y,h,m,s;
+    while(1)
+    {
+        rtc.readDateTime(&dw,&d,&M,&y,&h,&m,&s);
+        rht.readData();
+        Temp=rht.getTemperatureC();
+        Hum=rht.getHumidity();
+        lcd.cls();
+        lcd.setAddress(0,0);
+        lcd.printf("%02d/%02d/%4d",d,M,y);
+        lcd.setAddress(0,1);
+        lcd.printf("%02d:%02d:%02d",h,m,s);
+        
+        wait(3);
+        lcd.cls();
+        lcd.setAddress(0,0);
+        lcd.printf("Temp:%.1f",Temp);
+        lcd.setAddress(0,1);
+        lcd.printf("Hum:%.1f",Hum);
+        wait(3);
+        
+    }
+
+
+    return 0;
+
+}