Serial monitor seemingly getting an additional input

Hi all,

Hopefully I'm asking in the correct topic.
The code below is meant to read an input from the serial monitor and do stuff depending on what is read.
Weirdly, it seems to read the input twice- if I enter '1', it displays "LED is ON" as expected and below it there is "Invalid option". I only enter 1 and press enter.
Unless I am missing something there should be only one output.
This also happens with another piece of code, where a char is supposed to be stored (which works) but gets cleared immediately after because it seems another loop is run after the first one with blank input.

Please let me know if you can find a fault in the code below or if it's a board problem encountered before.
Thanks
"
void setup() {
Serial.begin(9600);
pinMode(13, OUTPUT); // LED on pin 13 of UNO
}

char rx_byte = 0;

void loop() {
if (Serial.available() > 0) { // is a character available?
rx_byte = Serial.read();

switch (rx_byte) {
case '1':
digitalWrite(13, HIGH);
Serial.println("LED is ON");
break;

case '2':
digitalWrite(13, LOW);
Serial.println("LED is OFF");
break;

case '3':
Serial.println("------- MENU -------");
Serial.println("1. Switch LED on.");
Serial.println("2. Switch LED off.");
Serial.println("3. This menu.");
Serial.println("--------------------");
break;

default:
Serial.println("Invalid option");
break;
}
}
}
"

What is the line-ending setting on the serial monitor?
(Hint: the correct answer is “none”)

Please remember to use code tags when posting code

1. This is the problem (Fig-1) you are having:
sm23x.png
Figure-1:

2. This is (Fig-2) what you want to achieve.
sm12.png
Figure-2:

3. This is the layout (Fig-3) of Serial Monitor.


Figure-3:

4. Troubleshooting.
Compare Fig-1 and Fig-2 and then look into Fig-3 for the Line ending tab.

sm12.png

sm23x.png

Thank you very much.