block sequence

hello, I have a problem with this program, if I run the command 1 and 2, the Arduino then interprets me both with the delay, but I want to recive the two impulses if followed in a second 1 and 2 do not interpret any. It is possible to do ?

Thanks

void setup() {

  Serial.begin(9600); 

      for (int thisPin = 2; thisPin < 5; thisPin++) {
        pinMode(thisPin, OUTPUT);
      } 
}

void loop() {
  
  if (Serial.available() > 0) {
    int inByte = Serial.read();
  

    switch (inByte) {
    case '1':   
      digitalWrite(2, HIGH);
      delay(500);
      digitalWrite(2, LOW);
      break;
    case '2':   
      digitalWrite(3, HIGH);
      delay(500);
      digitalWrite(3, LOW);
      break;
    case '3':
      digitalWrite(4, HIGH);
      delay(500);
      digitalWrite(4, LOW);
      break;
    default:
     
      for (int thisPin = 2; thisPin < 5; thisPin++) {
        digitalWrite(thisPin, LOW);
      }
    } 
  }
}

It's impossible to understand your question. Try to make it more clear.

The delay()s are probably getting in your way because they block the Arduino until they finish.

Look at serial input basics for receiving data without blocking and look at several things at a time to see how to use millis() to manage timing without blocking.

...R