Can't figure out how to get a sketch to release the com port

Learning away and using serial monitor for debugging

BUT -> when I close the serial monitor and go on to a new sketch, I can't initialize the serial port in a NEW sketch with serial.Begin without getting a notice that the serial port is already in use. This makes sense since the previous sketch is still running and sending info back through the port.

Is there any way to stop the sketch without unplugging from the usb? The reset switch restarts it but it is still hanging on to the serial port.

I can't initialize the serial port in a NEW sketch with serial.Begin without getting a notice that the serial port is already in use.

You computer give you that error message. It is nothing to do with the Arduino.

If you have uploaded a new sketch then you have already used the serial port to do that.
Are you using the serial monitor in the IDE? All that is done for you.

If not you will have to close down your serial monitor or at least disconnect it.

well its doing it again AND it wont stop. Unplugged arduino, closed ide. plugged back in opened the sketch , same result.
win8.1
ide 1.0.5 r2

now NO serial port is listed in the ide menu, system manager shows arduino uno on com3 working properly.

error message from ide:
Binary sketch size: 3,310 bytes (of a 32,256 byte maximum)
processing.app.SerialNotFoundException: Serial port 'COM3' not found. Did you select the right one from the Tools > Serial Port menu?
at processing.app.Serial.(Serial.java:191)
at processing.app.Serial.(Serial.java:77)
at processing.app.debug.Uploader.flushSerialBuffer(Uploader.java:77)
at processing.app.debug.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:175)
at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:67)
at processing.app.Sketch.upload(Sketch.java:1671)
at processing.app.Sketch.exportApplet(Sketch.java:1627)
at processing.app.Sketch.exportApplet(Sketch.java:1599)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2380)
at java.lang.Thread.run(Thread.java:619)

maybe its a windows fault. An OLD comutility can't detect the port as assigned yet it was initialized in event monitor when i plugged in the Arduino.

Imgur

walshlg:
maybe its a windows fault. An OLD comutility can't detect the port as assigned yet it was initialized in event monitor when i plugged in the Arduino.

One is detecting if the driver is present, the othe is detecting if it is being used.

walshlg:
when I ... go on to a new sketch..... the previous sketch is still running and sending info back through the port.

That doesn't make any sense, since if you are on a new sketch, the old one got zapped already.

this is really discouraging, I'm ready to give up arduino.

I make a new version of the sketch as i debug each part and I can't upload it as the port is in use even if I close serial monitor. Quit the ide, unplug arduino, restart ide and you can't select ANY ports says no ports are available.

IMHO serial monitor is the most likely culprit. But whatever the cause, I can't work on a sketch without cold rebooting of my computer, restart doesn't even do the trick.

what arduino are you trying to use?

I can't upload it as the port is in use even if I close serial monitor

When you click on the upload button the serial monitor should automatically close. That is what it does on any computer I have used.

You might want to change the title of the first post to mention win8.1, in a hope of getting some one who uses that OS to answer.

OK found the problem: its a bad Uno usb connector. Can see some problems with the pins, my Leonardos are working fine.

P.S. sorry about the blink, on some forums its nice and slow, will try to rebuild the .png with more frames.