String serialCommand = "";
String serialCommand1 = "";
bool serialAvailable = false;
int commandLength = 0;
char commandChar;

void setup() {
  Serial.begin(9600);

}

void loop() {
commandLength = Serial.available();
Serial.println(commandLength);
serialAvailable = (commandLength > 1);

if(serialAvailable)
{
  for(int i = 0; i<commandLength; i++ )
  {
    commandChar = Serial.read();
    serialCommand += commandChar;
    //Serial.print(commandChar);
  }
  Serial.println(serialCommand);
  serialAvailable = false;
  commandLength = 0;
  serialCommand = "";
}

  delay(1000);
}


String readSerialCommand();
{
    if(serialAvailable)
  {
    for(int i = 0; i<commandLength; i++ )
    {
      commandChar = Serial.read();
      serialCommand += commandChar;
      //Serial.print(commandChar);
    }
    Serial.println(serialCommand);
    serialAvailable = false;
    commandLength = 0;
    serialCommand = "";
  }
}