Clearing a String

No I tried doing that. Here is the code that I am using.

while (Serial.available() > 0) {
      char c = Serial.read();
      readString += c;
  }
  
  if (readString == "<T1>")
  {
    Serial.println("Hello");
  }
  else
  {
    readString == "";
  }

All I need to do is in the else statement, clear the String readString so that I can read the next input properly.

1 Like