Network, SD, Readall. comments added

Dependencies:   Peripherals Buffer_lib_v2 SD_Lib_EffedUP_ERP Time_Lib_v2 Year3_Version5 BMP280 Network_Lib TextLCD BME280

Revision:
7:981670f59caf
Parent:
6:2ef9c06ce506
Child:
8:dde5976445b4
--- a/main.cpp	Fri Nov 23 12:40:27 2018 +0000
+++ b/main.cpp	Fri Nov 23 14:20:10 2018 +0000
@@ -19,6 +19,7 @@
 void SetingTimeWithButtons ();
 void FunctionSensor();
 void FunctionTime();
+void FunctionSerial();
 
 TextLCD lcd(D9, D8, D7, D6, D4, D2); // rs, e, d4-d7
 SDBlockDevice sd(PB_5, D12, D13, D10); // mosi, miso, sclk, cs
@@ -35,6 +36,14 @@
 
 Thread t1;
 Thread t2;
+Thread t3; 
+
+
+//LDR sensor
+AnalogIn LDD_ADC_In(A1);
+float fLDR = 0.0;
+float volts = 0.0;
+
 
 
 //Main thread
@@ -62,7 +71,8 @@
     
     // run threads
     t1.start(FunctionSensor);           
-    t2.start(FunctionTime);    
+    t2.start(FunctionTime);   
+    t3.start(FunctionSerial); 
        
 }
     
@@ -327,4 +337,47 @@
             }
         }
              
-}  
\ No newline at end of file
+}  
+
+void FunctionSerial()
+{      
+  date_mutex.lock();
+    
+      lcd.cls();
+        lcd.printf("Observe Putty\n\n");
+        
+        
+        pc.printf("\n\rEnter command:\n\r");
+        pc.printf("READ ALL \n\r");
+        char str[9] = "READ ALL";
+        // reads for 8 waiting for new line and ignoring spaces
+        pc.scanf("%8[^\n]*c",str);
+        //prints typed command
+        pc.printf("Chosen Command = ");
+        pc.printf("%s\n\r",str);
+        
+        //check if typed command is equal to string
+        if (!strcmp(str, "READ ALL")) {
+        //if (str == "READ ALL") {
+           // pc.printf("yay\n\r");
+            
+            //get current values 
+            double temp = sensor.getTemperature();         
+            double pressure = sensor.getPressure();
+            fLDR = LDD_ADC_In; 
+            volts = fLDR*3.3f;
+            strftime(lcdBuffer, 32, "%d/%m/%Y %H:%M:%S,", localtime(&currentTime));
+ 
+            pc.printf("Date and Time = %s\r\n", lcdBuffer);
+            pc.printf("Temperature = %6.1f deg C,\n\r",temp);
+            pc.printf("Pressure = %.2f mB,\n\r",pressure);
+            pc.printf("Light = %6.4f volts,\n\r", volts);
+            
+         }
+        else {
+            pc.printf("INVALID COMMAND\n\r");
+        }   
+    
+    date_mutex.unlock(); 
+    
+}
\ No newline at end of file