Serial Monitor values appear to lag

Using this code in the IDE 2.0.0-beta5

const int potPin = A0; //Circuit is a potentiometer from 5V to GND, with middle pin at A0;

void setup() {
  Serial.begin(9600);
}

void loop() {
  
  int reading = analogRead(potPin);
  Serial.println(reading);

}

When I open up the serial monitor window, and then semi-rapidly adjust the potentiometer, the values on the Serial monitor lag substantially behind the actual movements.

When I run this same code using the IDE 1.8.13, there is no perceptible lag on the serial monitor window values.

I am using a macOS Big Sur V11.3

try to use a much faster baud rate… at 9600 bauds your loop fill in pretty quickly the outgoing buffer and then print will become blocking…

try 2,000,000 for example (if your Serial monitor allows for this) just to remove this issue

(there might be something else at play)

1 Like

The highest the IDE BETA serial monitor baud goes to 115200. I tried that and the lag was still just as bad.

I am really not looking for a “work around” though, I am trying to provide feedback to the Arduino IDE developers of possible issues.

When I downloaded the beta, the note on the download page said:

Note: this software is still in beta status, which means that it’s almost complete but there might be minor issues. Help us test it and report your feedback in the forum!

So every time I write a sketch, I try in the BETA first, and if I run into an issue (like this one), I compare it with the stable Arduino IDE. If I see a difference that doesn’t seem correct behavior to me, I have been making posts here.

Thanks for your help!

After line:

Serial.println(reading);

I added line:

delay(100);

This way Serial monitor give 10 reading each second.

sorry I did miss the context.

1 Like

Hi @M_James_O. Thanks for trying the beta stage Arduino IDE 2.x and providing your valuable feedback!

This is a known issue:

1 Like

Yes it will but this is not the point. The problem is getting more frequent updates, not delaying the system so that it is veer very slow. We want it fast, not only for debugging but for serial outputs that have to be sent quickly.

It seems serial monitor with no perceptible lag it’s not an easy task for IDE 2.0.0 developers.

For sketch with hundreds updates per second in serial monitor I’m not going back to IDE 1.8.13, instead I’m using online editor in browser:

https://create.arduino.cc/editor/