Serial Monitor - how to open automatically?

Hello:

I just got into Arduino programming - and am having a blast! I've got some experience with C programming, so this is really fun.

I've got a question on the Arduino IDE operation (I'm running version 0022):

Is there a way to make the "Serial Monitor" window open automatically without having to click on the Serial Monitor icon?

Every time I compile and upload the software to the Arduino, the Serial Window closes. Then I have to open it again.

Thanks,

Jim

I know how you feel about having to reopen the serial monitor. Over time I found that memorizing the "Upload" and "Serial Monitor" short cuts help. Habitually I just hit the Serial Monitor's hotkey after the LEDs stop flashing.

Late night troubleshooting is made interesting when I am waiting for serial output from a program that doesn't have any. :wink:

I rarely use the built in serial monitor, I use an external terminal emulator. That leads to additional complications though, as you have to remember to take the terminal offline before you upload the sketch. Just to further complicate matters I also tend to use Notepad++ as my editor, so I need to remember to save the edit, turn off the terminal then do the build/upload.

Bottom line is that having to re open the serial monitor if far easier if you don't need or use the advanced editing or serial macro functions :slight_smile:

One day I will script Notepad++ to do the Build process but as noted by James, the short cuts become habit before too long.

Cheers
Chris

Late night troubleshooting is made interesting when I am waiting for serial output from a program that doesn't have any.

Sounds a lot like falling asleep watching TV during a commercial, on a program you really were interested in seeing through to the end.
:wink:

KE7GKP:
There have been many previous discussions about this. This behavior is an artifact of how the operating system and logical ports work. When you upload a sketch to Arduino, the upload process takes control of the serial port. The OS won't allow more than one process to talk to a port simultaneously (for the obvious reasons). So the OS shuts down the Serial Monitor process.

Not quite correct. The OS does allow multiple processes to open files/devices. It can also forbid it.
It is up to the application doing the open to require whether or not it wants exclusive use of the port.
I'm not sure what the IDE does when it opens the serial port but I do know that the current avrdude opens
the port in exclusive mode. Because of this, the IDE must close the serial port in order for avrdude to be able
to open the port.

It is unfortunate that avrdude does its open in exclusive mode. (it is a simple 1 line change to eliminate this).
There are some very interesting things that could be done if it didn't do this.
For example, auto-reset works by the dropping of DTR. This drops on the first open and rises back on the last close.
If avrdude were changed not to require exclusive access of the port, the IDE could leave the port open
when it started avrdude to disable autoreset. This would be very useful for things like using the arduino
as and ISP programmer, which so many people are having issues with.

But on the original topic, I've always thought that the IDE should be smart enough
to restart the serial monitor if it closed it for the upload.
In other words the most reasonable thing to do seems like restoring the serial monitor
state to what it was prior to the upload. In fact it could even leave the terminal window up and
merely disconnect it from the port during the upload and then re-connect when the upload
is complete so that none of the existing serial output is lost.

--- bill

I like having a processor with 2 serial monitors - download code on one, use the 2nd for input/output. Especially one that allows more than just characters as input, and can repeat entries for you. RS232MON from EVMSoft is very nice for that - use it to output HEX that can be recieved and acted upon without havig to convert first, and for displaying your hex output.

If you use an ISP instead of the bootloader the problem ceases to exist because the ISP will listen on a different port. However it is true that a software solution would be nice. Of course it could be blamed to avrdude. However avrdude existed before Arduino IDE, so the IDE should have accounted for it. Just one more reason to not use the standard IDE.

While avrdude existed prior to the IDE, it was actually avrdude that really needed a few simple updates
to make certain things simpler for arduino users.
Some of these types of issues can be handled in software but can not be solved in software outside of avrdude
or at least not without some updates to avrdude. So the IDE could not work around it.
For example for Auto-Reset, the thing to do would have been to define a "arduino" programmer type in avrdude
and then use RTS instead of DTR and wiggle the RTS line in software inside avrdude rather than depend on DTR/RTS behavior
to be controlled properly by the OS during open/close which also requires that the OS be configured properly to enable this
behavior.

--- bill

For example for Auto-Reset, the thing to do would have been to define a "arduino" programmer type in avrdude
and then use RTS instead of DTR and wiggle the RTS line in software inside avrdude rather than depend on DTR/RTS behavior
to be controlled properly by the OS during open/close which also requires that the OS be configured properly to enable this
behavior.

As far as I know there is a defined 'arduino' programmer defined in AVRDUDE and used in the last prior couple of arduino IDE versions. And avrdude is now what toggles dtr/rts to reset the board. Prior to that change the IDE did the dtr/rts toggle right before calling avrdude. DTR must be the signal used as many present boards only wire the dtr signal to the reset pin (through a cap) so rts alone toggled would never create a auto-reset for those boards.