Is there a command to open the Serial Monitor from a sketch?

I cannot find a command in the reference area that will open the serial monitor from a sketch. Is there such a command? Thanks.

I don't believe so.

All the Arduino can do is send serial data to the computer, it can't execute programs.'

Why do you need to launch the monitor from the code? If you give us some background, perhaps we can help you develop an alternate solution.

Thanks for your reply. I'm a total newbie and have modified the start-up kit KnockLock sketch to only print to the serial monitor when the data have changed, as opposed to scrolling constantly when there is nothing new to report. It's easy enough to click on the icon in the Arduino IDE to open the serial monitor. I just was curious to see if I could open the monitor from the sketch.

Write a desktop app and access the serial com port.... then you can send a command to display the serial data.

Easy enough I suppose.

The reason the Arduino sketch can’t open the Serial Monitor (or any other program) is because, in general, the PC program needs to have established a link to the Arduino before it can receive data from the Arduino.

The usual thing would be to have a long-running program on the PC that listens continuously for data sent by the Arduino.

It is probably possible to set up the PC so it will run a program when a USB device is connected. Setting that up is probably not a trivial exercise. And I’m not sure if it will happen without physically disconnecting the USB cable every time.

…R

Any solution you implemented that achieved this would require something to open the serial port automatically, which would then make it impossible for the IDE to connect to the Arduino to upload a sketch to it. I suspect you'd find that was more of an annoyance than the original problem you are trying to solve - whatever that is.