joseph adamu / Mbed OS CW_final_thr

Fork of CW_copy by Calvin Kalintra

Revision:
1:dc648c5624b9
Parent:
0:4e623dbef4b8
--- a/main.cpp	Wed Jan 03 17:32:16 2018 +0000
+++ b/main.cpp	Wed Jan 10 09:50:29 2018 +0000
@@ -1,71 +1,36 @@
 #include "mbed.h"
 #include "TextLCD.h"
+#include "operation.h"
 #include "BMP280.h"
-#include "putty.h"
-#include"date.h"
-//DigitalOut myled(LED1);
-
-
-Ticker display;
+//#include "Networkbits.hpp"
 
 
-void lcddisp()
-{ 
-    getdata();
-    store();
-    lcd.cls();
-    display_time();
-    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);
-}
+Ticker display; // timer  interrupt 
+Ticker second_pass; // timer  interrupt 
+InterruptIn button(USER_BUTTON); // setting the b;ue button on the board  
+Thread t1,t2; // class allows defining, creating, and controlling thread functions in the system. 
 
-
+    
 
 int main()
 {
-    lcd.cls();
-    display_date();
-    while (pointer != 14)
-    {
-        select_date();
-    }
-    bmp.initialize();
-    pc.printf("putty ready\n\r");
-    display.attach(&lcddisp, 2.0);
-    while(1)
+    lcd.cls(); // clear lcd
+    displaying_date_and_time(); // displayin the time and date 
+    while (cursor != 14) // while loop when cursor is not 14 it performs the function 
     {
-            int count = 0;
-            int wcount = 0;
-            //char c[20] = {0};
-            //char c2[20] = {0};
-            while (user_command[wcount]!= ' ')
-            {
-            user_command[count] = pc.getc();
-            pc.putc(user_command[count]);
-            count++;
-            wcount = count -1;
-            }
-            int count2 = 0;
-            int wcount2 = 0;
-            while(user_command2[wcount2]!= '\r')
-            {
-            user_command2[count2] = pc.getc();
-            pc.putc(user_command2[count2]);
-            count2++;
-            wcount2 = count2 -1;
-            }
-            
-            
-            pc.printf("you typed: %s %s\n\r",user_command,user_command2);
-            selection();
-            clear();
-            clear2();
+        button_select_date();
     }
+    bmp280.initialize(); // intialisation of the BMP280 sesnor
+    pc.printf("putty ready\n\r");
+    display.attach(&dis_store_sensor_data,  2.0);
+    button.rise(&disp_check);
+    second_pass.attach(&tick, 1.0);
+    t1.start(disp_putty); // start thread of the function disp_putty 
+    t2.start( disp_check); // start thread of the function disp_putty 
+    while(1)
+  {
+   
+    }
+     
 }
-    
-    
-    
+    
\ No newline at end of file