Processing to Arduino - mouse stuff

Hi First post here. I'm new to Processing, but i've played around with the Arduino and C.

I want to design a program that will receive mouse coordinates from Processing.

I was looking around but didnt really find a simple mouse example. (closest one was this but what's all that long code on the bottom? I just need a basic square)

Is it just: port.write(mouseX); port.write(mouseY);

if so, how must this be processed on the Arduino? Is there some buffer fill detection I must watch for?


The mouseX and mouseY variables contain the current position of the mouse, relative to the Processing application’s window. So,


will send the mouse location to the Arduino. However, the location of the mouse will be sent as two strings of characters (123, 87 would be sent as “12387”) with no separation, and no clue what makes up a whole packet.


would be better, as the string sent would then look like “<123,87>”, and you can clearly see where a packet starts and ends, and where the data in the packet is divided.

Search the forum for “started && ended” for code for the Arduino to receive this kind of data.