Reset Fio for new sketch upload

Hello, I have successfully established a wireless connection among Fio and 2 series 1 pro XBEE modules. But my question is how can I stop the fio from sending me the data back so that I can upload a new program.

In other words, I currently have a program uploaded to my Fio and I am it is sending me some data back, but now I would like to upload another sketch. So when I click upload I get the error "Serial Com Port # already in use". I realized the error is caused since Fio is sending the data back through that port. So how do I stop the Fio from sending data back so I can upload another sketch. I know this could probably could be done by reset switch but how would you do that through the software.

I appreciate any help.

That error message means the PC is trying to use the COM Port, but something else is using it. Are you sure you are selecting the correct COM Port?

Yes I am using the right COM port as there is nothing else connected to my pc. And yes I know what that error means. The Com Port actually is being used by Fio which is sending the data back.

But my question is, how can I programmatically command the board to stop sending the data back, so that the port becomes free and I can use it to load another sketch.

Thank you for your reply.

No, you don't understand what that message means.

The device sending information is irrelevant. The error message means that IDE tried to open the COM Port and the Operating System said it was in use by another PC application. The OS doesn't care if the device is sending data. In fact, most Arduino sketches send debug information over serial but most people do not get that error when they try to upload.

Something on the PC has the COM Port open, THAT is what the error message means.

Oh ok. I see it. But that is kind of weird because I have nothing except arduino connected to my ports. I have checked that through device manager as well. Also to debug I switched to another pc and I am getting the same error. Also since I kept getting that error, I restarted my pc and interestingly for the first time when I press upload the uploading goes very smoothly but after that one time it never works again.

So I checked my XBEE on the explorer with the X-CTU. I pressed on Test Query and did not get any communciation. So I went to the terminal and saw bunch of data coming in. Then I turned off my Fio and tested the XBEE through Test Query and sure enough it worked and also uploaded the program.