Question about the Serial Event Example

Hi Everyone, Brand new to Arduino. Wanting to use a Uno in a test fixture. Intent is to send simple commands from a PC and let the Uno set or clear some IO pins.

The Serial Event example (from File->Examples......) seemed like a good starting point. I tried the example code and it worked! But... if I make some minor change to the code and re-load I get errors that say the COM port is busy (COM5). I have tried to power the Uno down and back up but the COM port is still unavailable. The only way I've found to try the modified code is to completely re-boot the PC and then reload.

Can someone tell me what I need to add to the example code to allow it to use the COM port after making changes? I've searched Google for an answer but can't find one that works.


This has nothing to do with your Arduino program. The PC program must CLOSE the serial connection before it shuts down.
Paul's also not a tutorial

Please use the flag symbol to alert a moderator, and ask them to move this topic.

Thanks Paul. Afraid I don't understand. The port that is causing a problem is the one the Uno is connected to - COM5. There is nothing else on the PC using that port. What do I have to do to close the port that the IDE is controlling?

I guess I am wrong in thinking that I should be able to leave the serial monitor open, make a change to the code, re-upload, and test. That doesn't work for me.
Oh well, thought this would be easy.
73, Mark

Your PC has an operating system. That is what is connected to the port. The program only talks to the operating system. If the program goes away without telling the operating system to release to serial port, then it never gets released, until you reboot the pc.
How do you shut down the IDE? Do you go through the FILE, CLOSE or do you just use the
"X" in the corner. The "X" gives you what you are getting.