Efficient spring splitting

Hello guys,

I am expecting a string from the serial port like the following: A22,B43,C56,D12,B40,

DOES ANYONE KNOW HOW I CAN SPLIT THIS INTO: CHAR A
INT 22
CHAR B
INT 43
CHAR C
INT 56 etc....

Any help would be apreciated. Also i need this to be as fast as possible.THAN-YOU

Are you receiving a string (NULL terminated array of chars) or a String (a String object) ?

If the former then look at the strtok() function to split the string at the commas then you can manipulate the data in the resulting strings to get what you want.

Another arduino will send the following:

Serial1.print("A22,B56,C76,D54")

How are you dealing with it at the receiving end ?
Have you got any code ?

Have a look at the parse example in Serial Input Basics - it should do what you want. You may find the other stuff useful as well.

...R

Could you edit your original post and change the confusing title to use the work sTring, instead of sPring?
:wink:
Pete