Arduino IDE 2.0.0 beta 5 fails on Serial.available()

The Example Code shown in the online documentation for the standard Serial.available() does not work on my Uno when built in the IDE 2.0.0 beta 5, but does work when built in IDE 1.8. I am running Windows 10 Pro 64 bit (20H2).

Please provide a detailed description of what you mean by “does not work”.

Using IDE 2.00 Beta 5, library function Serial.available() always returns zero, including when characters are entered into the Serial Monitor and followed by CR. Serial.print and Serial.println work OK. The following modified version of the example shown in Serial.available() - Arduino Reference always displays “Chars available = 0” .

int incomingByte = 0; // for incoming serial data

void setup() {
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
Serial.println(“Test of Serial.available()”);

void loop() {
int i = Serial.available();
Serial.print("Chars available = ");
delay (250);

// reply only when you receive data:
if (Serial.available() > 0) {
// read the incoming byte:
incomingByte =;

// say what you got:
Serial.print("I received: ");
Serial.println(incomingByte, DEC);


There was a change in the way the Serial Monitor input field works that I found quite confusing. Previously, you could press the Enter key to send the data from the input field, but now you must use Ctrl+Enter.

You might get the results you describe if you are trying to use Enter to send the data. Is that the problem?

Yes, the problem is with the new Serial Monitor in IDE 2.0 that needs Ctr+Enter to terminate the string. I totally agree with you that this is a most unfortunate change.

Running the same sketch built using the 2.0.0 beta 5 IDE, but using the Serial Monitor in IDE 1.8 shows that the embedded sketch’s operation is ‘normal’, that is Serial.available() returns non-zero when the CR is entered. Using the ucon terminal emulator the behavior goes even further, responding immediately when each character is entered, not waiting for a CR.

I confirm that Serial.available() is working correctly.

Thanks for you help.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.

Change to the keyboard control for Serial Monitor send is now being tracked by the Arduino IDE developers here: