Arduino Pro Micro, Including Mouse.h Changes the COM Port

Hi there, I am making a project with my Arduino pro micro. To make it simple, I'm making a keyboard that can be reconfigured by a user interface on a computer.

On my Arduino, I activate the keyboard.h, Keyboard.begin(); and Serial.begin(9600); All I'm doing is reading the incoming messages on the COM port and do actions depending on the received message.

With only "keyboard.h, Keyboard.begin(); and Serial.begin(9600);" , the Arduino is on the COM Port 26. Using AutoHotKey, I connected to the COM Port 26 and then send my messages to the Arduino. Everything works flawlessly.

The problem is the following

I want to add a way to move the mouse with the keyboard too.
Once I add Mouse.h and Mouse.begin(); The com port switches from COM26 to COM9. There is absolutely NO WAY to connect to COM9 using AHK and I don't know why...

TLDR; Without Mouse.h, My arduino is set to COM26. Once Mouse.h is added, My arduino is set to COM9 which doesn't work with AHK idk why.

If anyone have a clue, please help me :stuck_out_tongue:

With the following includes

I don't see any includes, actually I don't see any code in your post.

There is absolutely NO WAY to connect to COM9 using AHK and I don't know why...

That's a question for the AHK support, an Arduino forum is the wrong place to ask as it's completely unrelated to the Arduino world.

Well my question is mostly, is there a way to not change the COM Port automatically once mouse.h is included ?

And it's not just an AHK question, Try it with a serial analyzer. You can't connect to an Arduino Pro Micro that has a mouse enabled but keyboard you can

When you include Mouse.h, it projects as a different composite USB device, so it will be assigned a different COM port number.

I think you can reassign the com port numbers in Device Manager (though I haven't done this, at least not recently).

DrAzzy:
When you include Mouse.h, it projects as a different composite USB device, so it will be assigned a different COM port number.

I think you can reassign the com port numbers in Device Manager (though I haven't done this, at least not recently).

Ohhh I understand now, I plan on selling these devices to people. If I change the COM Port on my computer, do you think the arduino device will keep that COM# when plugged into another computer?

The com port is set by the OS in the PC, not in the Arduino.