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.

0

4 Answers 4

3

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.

1

The X-axis is fixed and nothing gets plotted on the X-axis. It has its own divisions and they are automatically set by the Arduino IDE. The Arduino IDE still has to do some improvements to its software so that the X- axis can be adjusted and plotted too! This is my experience so far and corrections are welcome!

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 and acknowledge you have read our privacy policy.

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