com port changes when i am uploading program(win 10)

I have an Arduino Leonardo (pro micro), and when i'm uploading the program from the Arduino IDE to the board, the port changes automatically, so i have problems when testing my circuit. For example, i have selected the correct port so it says something like: Arduino Leonardo in COM4, the i hit upload program and when it finishes it changes the port so it says now: Arduino Leonardo in COM5.

Also i have tried changing the port of the USB connection and keeps happening.

I need to solve this problem, i have a project i need to build for a class and this keeps me from using the serial screen so i can't advance in the making of the project.

It is a common issue with the Leonardo and even the new MKR boards.

You can actually lock the com port though in XP up to win 8 so maybe you can still do it in win 10.

Hook up just your Leonardo.

  1. Control panel
  2. Device manager
  3. Expand PORTS
  4. Right click on the Leonardos port and select properties
  5. Select port settings tab
  6. Select advanced
  7. Select the port you want to assign to the Leonardo. Doesn't matter if its marked as in use and
    you can ignore any message about that.
  8. Back out until you are in device manager again.
  9. I usually do a restart at this point.

Also dont forget the Leonardo needs the delay in the sketch for the serial port.

void setup() { 
 //Initialize serial and wait for port to open:
  Serial.begin(9600); 
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB
  }
}