Quantcast
Channel: Arduino - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 747

Problems with Split

$
0
0

Hi:

I'm trying to communicate arduino and processing using serial, but when i send a string and then i try to split it in processing is doesn't works. I want to split this string:

DEL:0.0229999995#ACC:2.12,9.87,0.00#GYR:-0.03,-0.12,-0.03#FIL:1.98,9.20,-0.03#MAG:0.00

Using '#' as delimiter to obtain this: DEL:0.0229999995

ACC:2.12,9.87,0.00

GYR:-0.03,-0.12,-0.03

FIL:1.98,9.20,-0.03

MAG:0.00

But split function only removes the '#' and it returns this:

DEL:0.0250000000ACC:2.15,9.55,0.00GYR:633.60,-664.19,-647.42FIL:2.03,9.63,-647.42MAG:0.00

Code: void dataDecode(String data){

try { // Parse the data

String[] dataStrings = split(data,'#'); for (int i = 0; i < dataStrings.length; i++) print(dataStrings[i]);

/*


Viewing all articles
Browse latest Browse all 747

Trending Articles