Serial plotter extra lines

Hi
Why do I have extra lines (on left side ) after a short time when the serial plotter is turned on?

int currentValue;
int previousValue;

void setup() {
  Serial.begin(115200);
  pinMode(PA7, INPUT_ANALOG);
  pinMode(PB14, OUTPUT);
}
void loop() {
  previousValue = currentValue;
  currentValue = analogRead(PA0);

  Serial.print("   currentValue = ");
  Serial.print(currentValue);
  Serial.print("   previousValue = ");
  Serial.println(previousValue+100);
}

Hi @tom321. You must use a specific format for serial data so Serial Plotter can understand it:

<label>:<value>,<label>:<value>\n
<label>:<value>,<label>:<value>\n
  Serial.print("currentValue:");
  Serial.print(currentValue);
  Serial.print(",previousValue:");
  Serial.println(previousValue+100);

Give that a try and then let us know if you are still getting unexpected plots.

and the plotter stutters


extra green

Some boards can put out some spurious serial output on startup. That could caused the plot you show in your screenshot. The situation might be more clear if you look at the data in Serial Monitor.

You might be able to solve the problem by adding a short delay in your setup function:

delay(500);

The second "previousValue" is a holdover (why? I do not know) from the previous "run" of the sketch... close the IDE and start where @ptillisch showed the format... and how did that sketch even compile?

Problem solved, thanks

You are welcome. I'm glad it is working now.

Regards,
Per

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