Arduino leanardo + Usb shield + logitech mouse

Im using an a Arduino Leanardo r3 board with an Usb host shield connected to a Logitech G502 mouse and using an external mouse instruct sketch from github to make it work but when i upload a new sketch to the arduino, the comport connected to the leanardo disconnects and disables my mouse. I tried using 2 comports at once but only one works at a time even after setting seprate comports for both it keeps switching between different comports available. I just wanted to check if there is a work around for this? thank you in advance .

Your topic has been moved!! Please do not post in "Uncategorized"; see the sticky topics in Uncategorized - Arduino Forum.

That is expected behaviour. The IDE opens and closes the serial port with a baud rate of 1200 baud to invoke the boot loader. In Windows this results in another COM port.

Once the bootloader is active, your sketch does not run so you loose your mouse.

Question is what is the problem that your mouse temporarily does not work; upload takes how long?

Work arounds:

  1. Add a second mouse to your PC and use that.
  2. Learn to use a PC without a mouse :rofl:

Mouse just stops working soon as any new sketch is uploaded also doesnt allow me to upload the sketch on the old comport which was used . Upload is quick maybe 5 secs max. My question is how can i use the mouse connected to the usb host shield and also upload a new sketch ?

Thank you for the workarounds though...I have 2 mouses connected so that i dont have to learn such a tedious task :sweat_smile: . I also have tried using the second mouse with the host shield but doesnt move the cursor even though USBHIDBoot mouse shows mouse movements.
Any help would be appreciated. Thanks

I'm a bit confused.

The Logitech mouse is used to control the Leonardo?
Are its movements/clicks passed on to the PC and the PC uses them like a directly connected mouse?
Whatever it was doing, it no longer does after an upload?
How do you recover from this?

While uploading your sketch, your non-logitech mouse stops working?
Or after the sketch is uploaded, the non-logitech mouse stops working?
How do you recover from this?

Maybe you should post you sketch; don't forget to use code tags as described in How to get the best out of this forum.

Note:
I'm not familiar with host shields.