How do I serial print to only the serial plotter, and not serial monitor?

I need to print a value in the serial plotter every 250ms, while having it print in the serial monitor every 4s. Any help would be greatly appreciated!

Hi @uncreative,

This is not possible. Any serial data received can either be printed on the serial monitor, or plotted on the serial plotter. They do not work at the same time.

You can use software serial to send the information to a second computer, using a UART to USB converter. Or use different, non-Arduino serial monitoring software, on the same computer.

Ok, that's what I would want ideally I think. How would I print something just for the serial plotter and not serial monitor? Thanks for responding.

The only difference is that when you call "Serial.print("");" in your code, it should be a number that it is printing. On the computer side, just open tools / Serial plotter.

Screen Shot 2021-09-02 at 7.42.29 AM

Yes, I realise I can't open the serial monitor and serial plotter at the same time, but if I were to switch from the monitor to the plotter, how would I make it print a value every 4 seconds to plotting a value every 250ms, is there any way?

No need for a second computer. Just use PuTTY or TeraTerm on the same computer.

Not besides what @gfvalvo said.

I don’t think there is a way to switch in the middle of the stream.

If you do find one that can be invoked in your code, obvsly that would be the place to set the rate at which values were published, destined either for the plotter or the text monitor.

a7

You don't, because your Arduino doesn't know what's connected to the other end of the Serial interface - if anything at all.
So long story short: there's no easy way to do this, sorry.

2 Likes

Attach a toggle switch to an Arduino pin. Before you open serial monitor, flip the switch one way. Before you open the serial plotter, flip the switch the other way. In your sketch, read the pin and use that to determine how often values are printed and what format to use

This makes a lot of sense, thank you so much

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