Parsing Integers from Serial data stream
Here is a sketch that uses strtok() and atoi() to parse the data and store the results in an integer array.



char testInput[] = "&lt;1,2,3,4,5,512&gt;\r\n";
uint16_t myArray[6] = {};

void setup(){

  Serial.begin(9600);

  int counter = 0;
  char* pch = strtok(testInput,"&lt;&gt;,\r\n");

  while(pch != NULL){
    myArray[counter] = atoi(pch);
    pch = strtok(NULL, "&lt;&gt;,\r\n");
    counter += 1;
  }

  // Print out the contents of the integer array.
  for(int i = 0; i &lt; counter; i++){
    Serial.println(myArray[i]);
  }

}

void loop(){}


EDIT

Based on your comments, I have another sketch for you to try.

// Sample input: &lt;1,2,3,4,5,512&gt;
char testInput[40];
uint16_t myArray[6] = {};
int counter = 0;

void setup(){
  Serial.begin(9600);
}

void loop(){

  if(Serial.available() &gt; 0){

    Serial.readBytesUntil('\n', testInput, 40);

    char* pch = strtok(testInput,"&lt;&gt;,\r\n");

    while(pch != NULL){
      myArray[counter] = atoi(pch);
      pch = strtok(NULL, "&lt;&gt;,\r\n");
      counter += 1;
    }

    Serial.print (myArray[0]);
    Serial.print (", ");
    Serial.print (myArray[1]);
    Serial.print (", ");
    Serial.print (myArray[2]);
    Serial.print (", ");
    Serial.print (myArray[3]);
    Serial.print (", ");
    Serial.print (myArray[4]);
    Serial.print (", ");
    Serial.println(myArray[5]);

    counter = 0;
  }
}