// Sample input: <1,2,3,4,5,512>
char testInput[40];
uint16_t myArray[6] = {};
int counter = 0;
void setup(){
Serial.begin(9600);
}
void loop(){
if(Serial.available() > 0){
Serial.readBytesUntil('\n', testInput, 40);
char* pch = strtok(testInput,"<>,\r\n");
while(pch != NULL){
myArray[counter] = atoi(pch);
pch = strtok(NULL, "<>,\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;
}
}