Arduino to Processing

Hi everyone,
I have a question need to your help.
I have computed roll, pitch, yaw from 2 MPU as image below
If i want to simulate motion of 2 sensors in processing, how to send data of them correct?
Thanks!

hmc2.JPG

You shouldn't have to change your Arduino code at all. You can just use the Processing Serial library: http://processing.org/reference/libraries/serial/index.html to receive and parse your data. From there I would address any questions to the Processing forums where you are much more likely to find someone with the needed experience.

with 1 sensor : I can use :

println(Serial.list()); 
  myPort = new Serial(this, Serial.list()[1], 115200);
  myPort.bufferUntil('\n');  
void draw() 
{

}  
void serialEvent (Serial myPort)
{
  String[] input = trim(split(myPort.readString(), '\t'));
}

but with 2 sensor, i don't know how to send data to each sensor correctly.

I am no Processing expert, but let's take a look at the code you posted.

This is the critical line:

 String[] input = trim(split(myPort.readString(), '\t'));

In this line you start by reading in a line of input from the serial port with

myPort.readString()

Then you split this into a list of strings with the split method. As you gave it the parameter '\t' you will break the string apart on tabs.

split(myPort.readString(), '\t')

Now you have a list of the line of input split apart into different tab separated parts, but the extra tabs are still there, so trim gets rid of the extra whitespace. This is assigned to an array of Strings to store each of the received values.

Now if you had the serial input that you posted here, you would have read in one entire line into the string array input. To get the value out you could use something like this.

//This code is untested but should be close
float firstValue = float(input[0]);
float secondValue = float(input[1]);
...

Thank guy, I also wanna ask 1 question :3 After i compute roll, pitch, yaw from sensor , i use

rotateZ -> for roll angle
rotateX -> for pitch angle
rotateY -> for yaw angle

but it not correct Could you guide me this prolem?