1

I am trying to plot my counter vs. time on the serial plotter, but the values on the y axis are so big there is no way that it's displaying the counter values. I have printed both values:

  Serial.print("counter: ");
  Serial.println(counter);
  time = millis();
  Serial.print("Time: ");
  Serial.println(time);

I expected time to show up in the x-axis, but I think it's displaying on the y-axis and I'm not sure how to change this. The plot should just be an increasing line as the counter and time get bigger... what am I missing? Thanks.

Slashing out the Serial.print("Time:") does not correct anything.

2

Inorder to plot multiple variables or waveforms simultaneously a 'space' is printed between the two print statements.

Serial.print(counter);
Serial.print(" ");
time = millis();
Serial.println(time);

OR

Serial.print(counter);
Serial.print("\t");
time = millis();
Serial.println(time);
1

Comment out the Serial.print("Time: "); line. The Arduino serial plotter wants only numbers.

0

To plot multiple values over time you need to output just the numbers on a single line per iteration, and delimit with a space or tab:

Serial.print(counter); 
Serial.print("\t"); // delimit with tab
time = millis();
Serial.print(time); 
Serial.println();

It's worth noting however, the time (x axis) is implied by each line. In essence each line of output advances "time" by 1 unit. So I suspect you'll want to remove the time variable output and just output the count variable by it self.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.