Hi all, I always see people posting in the forums wanting to use their arduinos as a keyboard or mouse, without extra hardware. After reading about the java robots class, I wrote a processing applet and arduino library that allow an arduino to send keystrokes, mouse clicks, and move the mouse on the computer over serial. Just include the library in your sketch, run the processing applet on the computer, and you're all set. Then you can call any one of the following functions from your arduino sketch:
mouseClick('L') mouseClick('R') for left or right mouse
keyStroke('A') A can be any character, but note that it will come out lowercase unless you keypress shift.
mouseMove(x,y) x and y are integer coordinates for where to move the mouse
specialKeyPress("KEY") "KEY" can be "SHIFT", "ALT", "CTRL", "UP", "DOWN", "LEFT" or "RIGHT"
specialKeyRelease("KEY") same as above, but releases key
Library can be downloaded here: http://www.filedropper.com/hidproxy . Place the unzipped folder in your libraries folder in sketchbook.
This is the processing sketch: http://www.filedropper.com/hidproxyprocessing . You may need to change the [ 1 ]
in Serial.list to a [ 0 ]
depending on whether you are using *nix or Windows.
Note: In order for this library to work you must include Serial.begin(115200);
in your setup routine.
I hope someone finds this useful!