Go Down

Topic: Simulate a mouse event (Read 1 time) previous topic - next topic

Frogeraie

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?

mellis

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 http://www.nastypixel.com/instantsoup/?page_id=19) and replacing some of its keys with optocouplers (described at http://www.potemkin.org/cms/Pid/SimulateButton) 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.  

Frogeraie

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?

Massimo Banzi

hello

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.

massimo

Frogeraie

#4
Feb 16, 2006, 04:52 pm Last Edit: Feb 16, 2006, 04:52 pm by Frogeraie Reason: 1
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!!!!!!

mellis

Check out the Processing Serial library:
http://processing.org/reference/libraries/serial/index.html

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:
A12
B123
A10
C1234
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() (http://processing.org/reference/libraries/serial/Serial_readStringUntil_.html) to read a line at a time.

Go Up