Problem with split() and serialEvent

Try this right after you receive string:
println(inString);

Try a delay() in setup() of Processing:

I like to test code on receiving side with simulated data:

String s = "113,206,46,212,102,195,211,114,33," + "\n";

print(s);

s = s.trim(); // Trims that \n before processing string

print(s);
println();

println(s);

String [] splitData = split(s, ',');

printArray(splitData);
printArray(float (splitData));

println(float(splitData[0]));

float [] splitFloats = float(split(s, ','));

printArray(splitFloats);

:)

1 Like