Arduino mega as joystick for pc

Do note that that only works on offical mega2560 and the faithful clones with a 16u2 as serial adapter. The ones with a single-function serial adapter chip (like the countless clones with CH340G serial adapters - though clones with 16u2 are available) - those can't be reprogrammed.