Thanks PaulS, can you please give me an example of what you mean? im very new and im not sure how to implement your solution
No, because using the String class for this purpose is a huge waste of resources. Very extensive text processing applications have been written using NULL terminated char arrays for decades before the wasteful String class was developed.
This code does not use the String call (or a bunch of unnecessary parentheses, and puts the { where they belong) but accomplishes the same desired functionality:
char *MyName = "AA";
char command[4];
if(Serial.available() == 2 && IncomingData == 0 && ConfigFlag == 0)
{
command[0] = Serial.read();
command[1] = Serial.read();
command[2] = '\0';
if(strcmp(MyName, command) == 0 && ReadyToStream == 0 && imready == 0)
{
Serial.print("OK&EMPTY&RAM");
Serial.println(memoryFree());
}
}