Simulate a mouse event

I would like to simulate a mouse click to control a video. Is it possible to use a sensor input to the i/o board to create a mouse or a keyboard event?

It is possible, but it might not be the easiest method for controlling the video. What specifically do you need to do?

You can simulate keypresses by taking apart a keyboard (described at Welcome - and replacing some of its keys with optocouplers (described at controlled by the Arduino board. Something similar should work for a mouse as well.

However, depending on what you need to do, it might be easier to have the Arduino board send commands over the serial port to the computer, where they are read and intepreted by a small program. For example, if you are (or can) play the video in Flash, then you could simply read the commands via a serial proxy. If you’re on the Mac, you could probably use some AppleScript to read the commands (possibly via a serial proxy) and then send script commands to Quicktime or iTunes, etc.

That’s exactly what i want to do: send a command from the board to the computer!
Do you think the serial proxy will do the trick?
On the Arduino site it is said that: “Also useful is the serial proxy for talking to an Arduino board from Flash or other programs.” Does it work the other way around: from the Arduino board to Flash?


serproxy is bidirectional… you can receive and send data from it.

if your programming language supports serial ports you can talk to arduino directly without using serproxy.

serproxy is useful with platforms like flash that, for security reasons, don’t support direct access to serial ports or the disk. serproxy communicates via the network to any program that can open a network connection.

if you tell us a little bit more about what language/platform you are using we can tell you how to do it.


I have an animated sculpture - a robot? - and different Processing clips running on nearby screens as java applets embedded in html files. The idea is to use the sculpture sensors outputs (analogic or digital) to send input to the Arduino board and translate these inputs into Processing functions such as mousePressed, mouseX, mouseMoved, keyPressed, etc…
Thanks a lot for your support!!!

Check out the Processing Serial library:

You should be able to create a simple protocol for the sensor data, write the data from Arduino over the Serial port, read it in Processing and trigger the right behavior.

You could try something like this, for example:
where the first letter of each line is the name of the sensor, and the number that follows gives the value of the sensor. You can use the Processing function readStringUntil() ( to read a line at a time.