One method of controlling the Arduino from a Processing program is to use the Arduino object in Processing. This talks to the program Firmata running in the Arduino. See my earlier post.
I made a simple example. You need to put the Arduino code in the Arduino. Adjust the serial port name in the Processing sketch, and I’m almost certain it will work.
There is a difficult problem that I found on Arduino Mega, and was the issue in this topic. The Arduino Serial was failing if it was sent a char when it wasn’t ready. I’ve only seen/heard of this on a Mega. I’m wondering if the Uno R3 has the same problem but I don’t have one to try.
When you start your Processing sketch, the Arduino resets. At that point have 500mS delay before sending to the Arduino. It think this will avoid the problem.