               // remove the current executed command
               strcpy(current_buffer, current_buffer + j + 1);
               break;
-          }
-          else{// the string is not completed ... so I must wait more...
-            break; // for i
-          }
-        }
-        
+            }
+            else{// the string is not completed ... so I must wait more...
+              break; // for i
+            }
+          }
+        else
+          if (current_buffer[i] == 'L'){// locks motor
+            // find the terminal character #
+            int j = i + 1;
+            for (; j < buffer_length && current_buffer[j] != '#'; j++);// parse until I find the termination char
+            if (j < buffer_length){
+              char tmp_str[64];
+              strncpy(tmp_str, current_buffer + i + 1, j - i - 1);
+              tmp_str[j - i - 1] = 0;
+              int motor_index;
+              sscanf(tmp_str, "%d", &motor_index);
+              lock_motor(motor_index);
+              // remove the current executed command
+              strcpy(current_buffer, current_buffer + j + 1);
+              break;
+            }
+            else{// the string is not completed ... so I must wait more...
+              break; // for i
+            }
+          }
     }
   }
   

  digitalWrite(enable_pins[motor_index], HIGH); // disable motor
}
//--------------------------------------------------------------------------------------------
//Reset pins to default states
void reset_pins()
{


char is_command_running;

char firmware_version[] = "2015.11.10.7";

AccelStepper *steppers[num_motors];

