Arduino Mega 2560 vs Arduino Mega 2560 r3

So I have been doing some testing on an Arduino Mega 2560 r3 outside of a system. Now I tired uploading the code to an Arduino Mega 2560 (this is what the system already has) but it doesn't let me upload the code. I am using the Arduino 1.6.1 software and it gives me this errors.

avrdude: ser_open(): can't open device "\.\COM5": The system cannot find the file specified.
avrdude: ser_drain(): read error: The handle is invalid.
Problem uploading to board. See for suggestions.

Is it possible to upload my code to a Arduino Mega 2560?

Thank you for the help


You sure the COM port didn't change when you plugged in the other board?

I don't think so, I tried multiple times. Trying to upload the same code, from the same port, with the same cable but it displays that error when I try an upload. Here is my code. There are some libraries added to it so I don't know if that could be the problem.

I appreciate the help.

Code_for_new_DC-DC.ino (4.21 KB)

But none of those things address the COM Port changing.

Your code won't cause that error message. It's avrdude not being able to open the com port.

Look at Device Manager and see if the board is getting a different com port. (Or look at the Port listing to see if the list changes there.)

Sorry for the late reply.

I reconnected it today and it worked fine, in case I run in the same problem again I will check that.

Thank you