Is it possible to call the serial monitor from setup so that a printed message is displayed without having to click the Serial Monitor icon first?
DMKWSU:
Is it possible to call the serial monitor from setup so that a printed message is displayed without having to click the Serial Monitor icon first?
Probably not.
No.
How do you expect to be able to send a command to turn the serial monitor on, if the serial monitor is not already turned on to receive that command?
JohnLincoln:
How do you expect to be able to send a command to turn the serial monitor on, if the serial monitor is not already turned on to receive that command?
It is not the serial monitor that receives the command to turn it on though, is it ? You might as well ask how do you expect to be able to click an icon to turn the serial monitor on, if the serial monitor is not already turned on to receive that click, but that is how it works.
You might as well ask how do you expect to be able to click an icon to turn the serial monitor on, if the serial monitor is not already turned on to receive that click, but that is how it works.
The way I read the original post, OP was asking if there was a way to tell the IDE to open the serial monitor. And, obviously, the answer is no.
PaulS:
The way I read the original post, OP was asking if there was a way to tell the IDE to open the serial monitor. And, obviously, the answer is no.
That's the way I read it too. However, it is not obvious to me why the IDE could not open the serial monitor when the upload to the Arduino is complete.
If the serial monitor is already open when the arduino starts up, the serial monitor can receive the message as long as the serial monitor is connected to the port associated with the arduino. The OP's "to call the serial monitor" is somewhat vague and not descriptive of just what specific action is desired.
That would have to be in the IDE code that runs on the computer, I suppose there could be an IDE option to:
"Upload sketch and open serial monitor" ??
What if he wanted to open the serial monitor when he does Serial.begin(), which might be an hour after the sketch starts? The thing is, the computer does not know if the Arduino has done a Serial.begin() or not. The PC is connected to the Atmega16U2 which does the USB interface. The Atmega16U2 seems "live" to the computer, whether or not the Arduino is sending it serial data.
Lets not forget that the IDE may not even be open when the Arduino is connected. So, expecting it to handle the "Open the serial monitor" request is not even reasonable.