Making a USB controller

I have a mega clone with the CH340G chip and all the basic stuff is working fine but I want to have a button press translate to a keyboard press. I know there is a command that does it (Keyboard.write();) but the command isn't compatible with my mega. I'm just wanting to know if I'm going about this project in the right manner and if I'm not then any suggestions will be appreciated.


If you want to use the Keyboard.write() function you should look at the documentation: "These core libraries allow an Arduino Leonardo, Micro, or Due board to appear as a native Mouse and/or Keyboard to a connected computer."

Note that "MEGA" is not listed.