Huseyin Berkay Berabi / GA-Final

Dependencies:   mbed-dev

Fork of GA-Berkay_Alex by Alejandro Ungria Hirte

Revision:
4:120ff05a7c27
Parent:
3:8bee1711d186
--- a/PC/PC.cpp	Wed Feb 28 16:10:21 2018 +0000
+++ b/PC/PC.cpp	Wed Feb 28 17:06:22 2018 +0000
@@ -22,27 +22,23 @@
     printf("\x1B[%d;%dH", Zeile + 1, Spalte + 1);
 }
 
+//This fufnction enable reading strings from matlab. 
 void PC::readcommand(void (*executer)(char*))
 {
     
-    //printf("Reads");
-    //while(1){
-    char input = getc();  
-    //printf("%c", input);           // get the character from serial bus
-    //printf("\x1B[1K");
-    //printf("-");
+    
+    char input = getc();  //get character from the serial bus
     
-     if(input == '\r') {  
-                   // if return was pressed, the command must be executed
+     if(input == '\r') {   // \r is our end of command character when this shows up, command will be executed !
+                   
         this->command[command_char_count] = '\0';
         executer(&command[0]);
         this->command_char_count = 0;                // reset command
         this->command[command_char_count] = '\0';
     //    break;
-    } else if (command_char_count < COMMAND_MAX_LENGHT) {
+    } else if (command_char_count < COMMAND_MAX_LENGHT) { //wait for other characters
        // printf("Debug Point 4");
         this->command[command_char_count] = input;
-        //printf(command);
         this->command_char_count++;
       
     }