I have been searching and trying around but at the moment I am stuck. I am trying to do the following:
I have a char array which comes in via the Arduino WiFi Shield:
char charBuffer[255];
...
int rxLen = Udp.read(packetBuffer,255);
The char array will look as follows:
*cmd|id|Length|data1|data2|data3#
The goal is to do the following:
int inCMD;
int inID;
int inLENGTH;
int inDATA[8];
inCMD = cmd; //range: 0 <-> 99 --> so max 2 chars in the array
inID = id; //range: 0 <-> 999 --> so max 3 chars in the array
inLENGTH = Length; //range: 0 <-> 8 --> so always 1 char in the array
inDATA[0] = data1; //range: 0 <-> 999 --> so max 3 chars in the array per dataX
inDATA[1] = data2;
inDATA[2] = data3;
The * is to mark the start of the array.
The | is to separate all data from each other.
The # is to mark the end of the array.
How can I now go through the char array and take out the different variables I need and transform them in the ints that I need? I just need a starting hand, to get me on my way I am not that familiar with working with chars and Strings.