FINAL PROJECT isn't it

Fork of ELEC351 by Plymouth ELEC351 Group T

Revision:
27:807dd5660c4b
Parent:
26:78f5e454e59f
Child:
28:09b5c46c8afd
--- a/main.cpp	Wed Jan 03 15:38:40 2018 +0000
+++ b/main.cpp	Wed Jan 03 16:26:42 2018 +0000
@@ -135,16 +135,16 @@
         } 
         else if(Serial_Input == "DELETEALL")
         {   
-            Sampling_Timer.detach();
-            Console_Output_Timer.detach();
-            for (int x = 0; x < mailsize; x++){
-                DATA *Delete_Data = mail_box.alloc();       //Allocate a block from the memory pool, Type Data
-                mail_box.free(Delete_Data);                 //Puts "Send_Data" into the mailbox
-            }
-            Sampling_Timer.attach(&Sampling_ISR,Sample_Rate);
-            cout << "Sampling Restarted" << endl;
+        Sampling_Timer.detach();
+        Console_Output_Timer.detach();
+        for (int x = 0; x < mailsize; x++){
+            DATA *Delete_Data = mail_box.alloc();       //Allocate a block from the memory pool, Type Data
+            mail_box.free(Delete_Data);                 //Puts "Send_Data" into the mailbox
+        }
+        Sampling_Timer.attach(&Sampling_ISR,Sample_Rate);
+        cout << "Sampling Restarted" << endl;
         } 
-        else if(Serial_Input == "READ.<n>") 
+        else if(Serial_Input == "READ") 
         {
 
         } 
@@ -175,9 +175,14 @@
             Console_Output_Timer.detach();
             Sampling_Timer.attach(&Sampling_ISR,Sample_Rate);
         } 
-        else if(Serial_Input == "STATE.<x>")
-        {
-
+        else if(Serial_Input == "STATE")
+        {   
+            Sampling_Timer.detach(); Console_Output_Timer.detach();
+            cout << "Turn Sampling On or Off:" << endl;
+            string State;   cin >> State;
+            
+            if(State == "On"){Sampling_Timer.attach(&Sampling_ISR,Sample_Rate);}
+            if(State == "Off"){Sampling_Timer.detach();}
         } 
         else if(Serial_Input == "LOGGING.<x>")
         {