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.

asked Feb 19, 2017 at 21:48
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);
answered Mar 22, 2017 at 5:30
1

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

answered Feb 19, 2017 at 22:47
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!

answered Oct 20, 2021 at 21:53
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.

answered Mar 22, 2017 at 2:21

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.