Arduino Leonardo recognized as xbox controller but not as an arduino in IDE

So, I wanted to use an arduino leonardo on my pc to create shortcuts, etc. The easiest way i found was to make my arduino as if it was an xbox controller so i could create shortcuts and macros easily via inputmapper. So i made my sketch and everything was fine and now it is recognized as a xbox 360 controller on windows. I tried to upload a modified version to fix some little mistakes i made but there was a problem : i could not see the arduino leonardo port in the IDE, only the COM 1. So now i can’t upload anymore to it because it is detected as a xbox controller but not an arduino leonardo. I use XInput and i read that i do not need to select a port if i uploaded a sketch (because obviously it is not detected anymore as an arduino) and only leave it blank. The problem here is that whenever i launch the IDE it sets autommatically on COM 1…
I searched all day on the internet for a solution but i cant find one, i need your help.
Here’s the link of the arduino leonardo i bought (it is not actually one but it says to choose this type of board in the IDE for it)

In the attach there is a screenshot of the error it gives me if i try to upload on port COM 1
I tried with another one (buy them in pack of 3) and even changed the cable but it doesn’t change anything and i also tried resetting it when it was uploading.

Thanks for your help !

What does Windows device manager say when you press and release the reset button of the Leonardo?

If it shows something in the line of "Leonardo Boot loader" in the ports section, you can press and release the reset button on the Leonardo when the upload starts (that is, when the IDE reports the memory usage).

If it doesn't show "Leonardo Boot loader", your boot loader is gone and you need to burn it again. You need either a programmer or another Arduino for that.

PS: where did you find instructions to change it to an "xbox controller"? Might make it easier for us to understand what you exactly did.

Hey, no it doesnt appear in the device manager and all the instructions i found are from here : GitHub - dmadison/ArduinoXInput: XInput library for USB capable Arduino boards
Oh and there’s no reset button on the arduino. It’s not a real leonardo so i need to wire the ground pin and the reset one together. Btw, do you know how to burn the bootloader ? I searched for hours and couldnt find the exact intructions for it.

Thanks in advance !

Here’s an image of the arduino pro micro.

One more thing, I tried with the third micro pro I had but this time I uploaded the XInput blink sketch to it. It is now recognized as a xbox360 controller on my pc and like the others, it isn't showing up the port (normally com6) in the IDE. I really feel like XInput is the problem and not my boards. How the hell could it delete the bootloader on all of them even with simple sketch of 6 lines ?

Oddest LEONARDO I have seen.

I would suggest using another arduino as ISP to upload to it as you probably corrupted the bootloader the very first time you tried to upload that particular sketch which you failed to link to ?

Could you also take a few moments to Learn How To Use The Forum.

Other general help and troubleshooting advice can be found here. It will help you get the best out of the forum in the future.

Here’s the code of the XInput blink sketch (that corrupted my arduino too) and mine.

#include <XInput.h>

void setup() {
	XInput.begin();
}

void loop() {
	XInput.press(BUTTON_A);
	delay(1000);

	XInput.release(BUTTON_A);
	delay(1000);
}
#include <XInput.h>
#include <CapacitiveSensor.h>

CapacitiveSensor   cs_4_2 = CapacitiveSensor(4,2);        
CapacitiveSensor   cs_4_3 = CapacitiveSensor(4,3);        
CapacitiveSensor   cs_4_5 = CapacitiveSensor(4,5);        
CapacitiveSensor   cs_4_6 = CapacitiveSensor(4,6);

void setup()                    
{
   cs_4_2.set_CS_AutocaL_Millis(0xFFFFFFFF);     // turn off autocalibrate on channel 1 - just as an example
   Serial.begin(9600);
   XInput.begin();
}



void loop()                    
{
   long start = millis();
    long total1 =  cs_4_2.capacitiveSensor(30);
    long total2 =  cs_4_3.capacitiveSensor(30);
    long total3 =  cs_4_5.capacitiveSensor(30);
    long total4 =  cs_4_6.capacitiveSensor(30);
  
    Serial.println(millis() - start);   // check on performance in milliseconds
    Serial.println(total1);

    if (total1 >= 1000) {
      
      Serial.println("Input 1");
      
      XInput.press(BUTTON_X);
      delay(1000);

      XInput.release(BUTTON_X);
      
    }
    else if (total2 >= 1000) {

      Serial.println("Input 2");

      XInput.press(BUTTON_B);
      delay(1000);

      XInput.release(BUTTON_B);
      
    }
    else if (total3 >= 1000) {

      Serial.println("Input 3");

      XInput.press(BUTTON_A);
      delay(1000);

      XInput.release(BUTTON_A);
      
    }
    else if (total4 >= 1000) {

      Serial.println("Input 4");

      XInput.press(BUTTON_Y);
      delay(1000);

      XInput.release(BUTTON_Y);
    }
    delay(500)                          // arbitrary delay to limit data to serial port 
}

I understand for the code but like i said, I tried with some offcial XInput code so im pretty sure it has nothing to do with that. It’s or the arduino or the XInput

sterretje: What does Windows device manager say when you press and release the reset button of the Leonardo?

If it shows something in the line of "Leonardo Boot loader" in the ports section, you can press and release the reset button on the Leonardo when the upload starts (that is, when the IDE reports the memory usage).

If it doesn't show "Leonardo Boot loader", your boot loader is gone and you need to burn it again. You need either a programmer or another Arduino for that.

PS: where did you find instructions to change it to an "xbox controller"? Might make it easier for us to understand what you exactly did.

And like i said, i tried 3 times with different board and different XInput sketch. All of them just made the arduino visible as a xbox360 controller but not anymore as a port. And I also want, like you said, to upload via my other arduino uno but I can't find any viable site that tells me how to do it properly. I looked for hours on the internet but never found an answer. That's why I asked, here, my last ressource.

The thing to look for as future reference is “arduino as isp

Those libraries mentioned in the sketch contain lots of extra code that would probably in this instance make a great deal of difference.

See the following about upload failures.

customcontroller: See the following about upload failures.

https://github.com/dmadison/ArduinoXInput_AVR#upload-warning-and-instructions

the thing is, i tried with a reset button and all but it doesnt change anything. It just searches for a com port but doesnt find one so it stops. I dont know what else to try.

@elimas4

That would tend to put you back on re-loading the bootloader as mentioned. Certainly it may help.

pls help i have the same problem as him. i tried burning the boot loader using uno as esp but it gave me an error. it also invovles the Xinput library, but i have an original leanardo.

3l3ctr0stat1c:
pls help i have the same problem as him. i tried burning the boot loader using uno as esp but it gave me an error. it also invovles the Xinput library, but i have an original leanardo.

You should post all the steps that you did so we can verify if you missed something.

You should pist a wiring diagram how you connected everything. Be aware that the SPI pins on the Leonardo are not 12, 23 and 13.

Lastly you should post the error messages that you got.

Ok, so 1. I use the Leanardo w/ Xinput board. 2. I upload it 3. I try to open the serial monitor. but it not open. 4. I check the ports, but the Leonardo doesn't show up in ports. 5. I check Bluetooth and devices, and I see Arduino Leonardo as a controller, which is expected since the Xinput library does that.

Note: all of that happened like a few weeks ago, now I'm trying to fix it.

  1. today I tried burning the bootloader.
  2. the wiring for the isp is sck to sck, mosi to mosi, and miso to miso, reset to rest, 5v to 5v, and gnd to gnd.
  3. i also tried mosi to miso and miso to mosi. ( i used the 6 pin interface on the leanardo and pins 11 12 13 gnd reset 10uf capacitor and 5v on the uno) and this is waht i did till now.

Error message for the burn.

i tried 2 versons of arduino, almost same message. new verson:

avrdude: Expected signature for ATmega32U4 is 1E 95 87 Double check chip, or use -F to override this check. Error while burning bootloader.

old verson: avrdude: Yikes! Invalid device signature. Double check connections and try again, or use -F to override this check.

Error while burning bootloader.

Thank you.

if found the solution, if you go to their website, there is a procedure for uploading sketches, https://github.com/dmadison/ArduinoXInput_AVR/blob/master/README.md under upI just tried it and it worked, just press the reset button twice quickly while uploading. Also noo need to introduce a port it is automatic.

@3l3ctr0stat1c

Thanks fort that update. Karma added.