This question already has an answer here:
I have an Arduino Mega 2560 connected to a Windows 8 laptop. I want to program it to send keystrokes to the attached computer (when a pin's digital read goes from HIGH to LOW.)
The trouble is, I cannot find any way to program my Arduino Mega to send keystrokes.
The supposedly "core" Keyboard and Mouse libraries only support 32u4 boards, and other libraries that give the Arduino keystroke functionality are out of sight. When I googled the issue, I found no question or explanation of how to send keystrokes on the Arduino Mega. When I searched further, I thought the V-USB library would be a potential workaround, but the library throws numerous errors when imported into an Arduino sketch (even on the 1.0.0 IDE it was designed for.)
After hours of searching, two final workarounds seem to have popped up:
- Some method to run a Python code to send keystrokes to the PC, and then connect the Arduino code to Python. (I don't know Python...)
- Use some program called Gobetwino, which runs between the Arduino and PC, to convert Serial commands into keystrokes somehow. (Pressing and releasing a key can't be simulated very well by repeatedly sending Serial commands, I think.)
Both are very unideal, very tedious, and are equally likely to just not work. I have spent hours on this.
Does anyone have any suggestions to get me out of this hell? Libraries, workarounds, anything?
(Feel free to PM me questions for clarification.)