Application programming

I used the accelerometer to control my mouse. I had never used node.js before, so I wanted to try it out. New cross-platform languages are always good. Ironically, though, the way to get node.js to move a mouse in a cross-platform way is to import Java :-)

I used the suggestion of this stackoverflow commenter to move the mouse around. Connecting to serial was straightforward: I simply used the README for the serialport library. I noted experimentally that the difference between flat and full-tilt was a difference of about 5000 between on and off readings for the coordinate, and used some simple math to convert between this and pixel positions.

The default node installation should suffice. To run, just type node move_mouse.js [tty] [x-res] [y-res]

move_mouse.js C code for board Makefile

And here it is in action:

(I wasn't touching my mouse as I made that video. It's a bit hard to take a video of the screen so that you can see the mouse such that you can also see the laptop trackpad at the same time...)