Menu with under menues

Hello,

i want a menue with under menues, like this:

--- Menu ---
(1) second menu

To be redirected to the second menue, send 1 via serial.

--- Menu ---
(1) second menu

--- Second Menu ---
(1) turn on LED

I've tried this code:

int ByteReceived;
int led = 13;
void setup()
{
  Serial.begin(9600);  
  pinMode(led,OUTPUT);
  Serial.println("--- Menu ---"); 
  Serial.println("(1) second menu"); 
  Serial.println("");
  ;
}

void loop()
{
  if (Serial.available() > 0)
  {
    ByteReceived = Serial.read();
  
    if(ByteReceived == '1')
    {
      Serial.println("--- Second menu ---");
      Serial.println("(1) turn on LED");
      Serial.println("");
      
      if(ByteReceived == '1')
      {
        digitalWrite(led,HIGH);
        Serial.println("LED on");
      }
    }
  }
}

But if send 1 only 1x time via serial, the second menue opens and the LED turns on. This is the serial monitor output:

--- Menu ---
(1) second menu

--- Second menu ---
(1) turn on LED

LED on

Who can help me?

Thanks

  if(ByteReceived == '1')
    {
      Serial.println("--- Second menu ---");
      Serial.println("(1) turn on LED");
      Serial.println("");
      
      if(ByteReceived == '1')
      {
        digitalWrite(led,HIGH);
        Serial.println("LED on");
      }

When ByteReceiced is equal to '1', it will print the second menu AND turn on the LED. You'd have to resolve that. It does exactly what you told it to do.