.

Dependencies:   BME280 BMP280 TextLCD mbed

Fork of CW_watchdog_09012018_copy by Calvin Kalintra

Revision:
0:7023c3f98f36
Child:
1:dc21a6fce3af
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Jan 06 17:28:05 2018 +0000
@@ -0,0 +1,85 @@
+#include "mbed.h"
+#include "TextLCD.h"
+#include "BMP280.h"
+#include "putty.h"
+//DigitalOut myled(LED1);
+int dislcd = 0;
+float T = 15;
+Ticker display;
+Ticker second_pass;
+InterruptIn button(USER_BUTTON);
+
+//NVIC_SetPriority(display, 0);     
+//NVIC_SetPriority(second_pass, 1);
+//NVIC_SetPriority(button, 1);
+void second_tick()
+{
+    ss++;
+    time_rule();   
+    day_check();
+    lcd.cls();
+    if (dislcd == 1)
+    {
+        lcd.locate(10,0);
+        lcd.printf("l:%1.2f", lvl);
+        lcd.locate(0,0);
+        lcd.printf("p:%3.1f", pressuref);
+        lcd.locate(10,1);
+        lcd.printf("t:%3.1f", tempf);
+        display_time();
+    }
+    
+    else if (dislcd == 0)
+    {
+        display_dates();
+        display_time();
+    }
+}
+
+void lcddisp()
+{ 
+    display_time();
+    getdata();
+    store();
+}
+
+void check_display()
+{ 
+    if(dislcd == 0)
+    {dislcd = 1;}
+    else
+    {dislcd = 0;}
+}
+
+
+int main()
+{
+    lcd.cls();
+    //display_date_time();
+//    while (pointer != 14)
+//    {
+//        select_date();
+//    }
+    bmp.initialize();
+    pc.printf("putty ready\n\r");
+    display.attach(&lcddisp, T);
+    second_pass.attach(&second_tick, 1.0);
+    button.rise(&check_display);
+    
+    
+    while(1)
+    {
+            check_display();
+            putty_write();
+            if (interrupt == 1);
+            {
+                T = t;
+                display.attach(&lcddisp, T);
+                interrupt =0;
+            }
+            check_display();
+    }
+}
+    
+    
+