I am looking for a short script, to let WIN10 recognize my Mega2560 as game device with one single pushbutton connected, so that I can calibrate that new game device inside Win10 later. What text or short script do I need ?
Paul, I wasn´t aware that Mega, Leonardo and Co are so different. I thought they are all depending on the language "C" and commands "scipt-language" are the same ? So to write a scipt, as you write, for a Mega 2560 is such a hugh effort, that it is not worth to do ? Just to let WIN10 recognize a push-button as game device ?
You are - as I gather - wishing to make the board appear to a PC as a game controller, which is quite a different sort of USB device to a serial interface. The earlier Duemilanove which was before the UNO, as well as the Nano and the vast majority of clones misleadingly claimed to be "UNO"s, use a dedicated USB to serial interface chip which can only function as a USB serial interface.
The Leonardo/ Pro Micro (different forms of the same device) use a chip which is usually programmed as a serial interface as part of the main code it executes. This means that when you program it, you can program that part of the microcontroller to be something other than a USB serial interface, such as a keyboard, mouse or game controller.
On a true UNO or Mega 2560, the USB interface chip is actually one of the same series of ATmega chips as that in the Leonardo/ Pro Micro but with somewhat lesser capabilities in terms of program memory and RAM. All these ATmega chips with built-in USB connectivity are denoted by the "U" in the part number. The 16U2 in the UNO is programmed to be a serial interface purely to communicate with the main ATmega328 chip that actually runs your programs.
It is however possible to re-program that 16U2 to appear and function as - a keyboard, mouse or game controller. It will still communicate by the serial protocol with the main ATmega328 chip which will need to read your inputs and send the data to the 16U2 in a form that matches what device you are emulating. Because you have re-organised the way the two chips work together, this makes it much more difficult than simply coding the ATmega328 (or the 2560). It is also tricky, but reprogramming the single microcontroller in the Leonardo/ Pro Micro is vastly simpler.