Why is the Visual Micro serial graph output jagged/lagging?

232 Views Asked by At

I started using Visual Studio 2022 with Visual Micro, Arduino 1.6/1.8 as my new Arduino IDE, because I needed some extra features, that the original Arduino IDE does not provide.

To plot a graph, I am using the breakpoint command {@Plot.windowName.graphName variable} to print out the graph for my variable x with x = sin(2i), i being incremented by 0.01 every cycle by a for loop.

Here is my code:

double x;

void setup() {
    Serial.begin(115200);
    Serial.println("Hello, World!");
}

void loop() {
    float i;
    for (i = 0; i < 1000; i=i+0.01) {
        x = sin(2*i);
        Serial.println(x);
        delay(50);
    }
}

Here is a picture of the breakpoint command:

Picture of the breakpoint-command {@Plot.plot.output x}

The graph this outputs looks jagged and has cyclically occurring lags every 1.5 second.

Sine graph in the serial plotter, with jagged edges instead of a smooth curve

Where might this originate from?

Is it the Visual Micro software, the speed/noisiness of the serial connection (bad cable, etc.) or the Arduino Uno being overloaded by that?

I already tried changing the data rates as recommended in the answer of visualmicro.

Unfortunately it is not about the data rate itself.

1

There are 1 best solutions below

0
VisualMicro On

The Serial Debugger in Visual Micro throttles the data coming from the sketch to prevent the PC becoming overloaded with Serial data.

If you enable the vMicro > Debugger > Full Speed (no throttle), this should speed up the data coming in.

Also the interval the chart refreshes at can be changed from the controls above it, in this scenario "At rate of incoming data" would be best suited.

vMicro Chart Controls (Click for image)