i can't make the led light

hello everyone

I'm a beginner in Arduino and trying to connect the 3 LEDs , and this my code

String LED;
void setup() {
  Serial.begin(9600);
  pinMode(11, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(13, OUTPUT);
}
void loop() {


  Serial.println("what is your led ");
  while (Serial.available() == 0) {
  }
  LED = Serial.readString();

  if (LED =="RED") {
    Serial.println(LED);
    digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
    delay(1000);                       // wait for a second
  }
   if (LED =="BLUE") {
    Serial.println(LED);
    digitalWrite(11, HIGH);   // turn the LED on (HIGH is the voltage level)
    delay(1000);                       // wait for a second
  }
    if (LED =="GREEN") { 
    Serial.println(LED);
    digitalWrite(12, HIGH);   // turn the LED on (HIGH is the voltage level)
    delay(1000);                       // wait for a second
  }

}

How does readString() know when to stop reading? It doesn't. It's probably the most useless function in Arduino.

If you have the line-ending setting in the Serial Monitor set to anything other than "none" then your string will contain line endings. None of your tests check for the string "RED" followed by a line ending character.

The simple solution is to change to no line endings. The real solution is to get away from reading big-S strings and look at the individual characters as they arrive.

Search for "Serial Input Basics - Updated".

Also, the String class (note uppercase S) is inefficient when compared to using C strings (lowercase s) built from char arrays. Your code used 4432 bytes. The code below:

void setup() {
  Serial.begin(9600);
  pinMode(11, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(13, OUTPUT);
  Serial.println("what is your led ");
  
}
void loop() {
  
  char whichOne[6];
  int charsRead;


  if (Serial.available() ) {
    charsRead = Serial.readBytesUntil('\n', whichOne, sizeof(whichOne) - 1);    // Need room for null
    whichOne[charsRead] = '\0';     // Make into C string    
    Serial.println(whichOne);
    if (strcmp(whichOne, "RED") == 0) {
      digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
    } else if (strcmp(whichOne, "BLUE") == 0) {
      digitalWrite(11, HIGH);   // turn the LED on (HIGH is the voltage level)
    } else if (strcmp(whichOne, "GREEN") == 0) {
      digitalWrite(12, HIGH);   // turn the LED on (HIGH is the voltage level)
    }
    delay(1000); 
  }
}

uses 2866 bytes and functions pretty much as you want it to. You still need to make some fixes to my code (e.g., what if they type in "red" in lowercase, what if they type in "PURPLE"). Also, this approach assumes you have the line ending list box set to "Newline" in the Serial monitor. Still, it's a place to start. You can find a list of C string functions here.