sending multiple values to processing

Hi guys,

im a novice at processsing and java, any help would be really appreciated!

Here's my arduino code:

Serial.print(sonar1.ping_cm(), DEC);
Serial.print(",");  
Serial.println(sonar2.ping_cm(), DEC);

I pass it to processing successfully. My problem is that I need these two values to continually send their values to processing and I don't know how to separate them into two different arrays.

Here's my processing code:

void serialEvent(Serial myPort) {

String MyString = myPort.readString();

if (MyString != null) {
MyString=trim(MyString);
String[] values = split(MyString, ',');

d1 = int(map(Integer.parseInt(values[0]), 0, 200, 400, 800));
d2 = int(map(Integer.parseInt(values[1]), 0, 200, 400, 800));


}}

Whenever I use values[1] I get a "Error, disabling serialEvent() for COMx - NULL"

Eventually I'll need to send 4 values instead of just 2 but for now I just want to get this working. Thanks in advance!

My problem is that I need these two values to continually send their values to processing and I don't know how to separate them into two different arrays.

Values don't send themselves. Code sends values in variables.

Here's my processing code:

That was SOME of the code. For that, you get some of the answer. You need to... (More later).