#include <serialStr.h>  // You'll need to install LC_baseTools co compile this.

#define MAX_NUMBERS   4

serialStr portMgr;              // This guy watches the serial port for you.
int       values[MAX_NUMBERS];  // We'll save the values here.

void setup() {
  
  Serial.begin(115200);
  portMgr.setCallback(gotStr);
  Serial.println("Enter a string with int;int;int;int");
}


// Strings show up here..
void gotStr(char* inStr) {

  char* token;
  int   i;

  i = 0;
  token = strtok(inStr,"\;");   // Dump first token it's the text.
  while (token) {               // Loop 'till you run out of numbers.
    if (i<MAX_NUMBERS) {
      values[i] = atoi(token);    // Save it's actual value for later.
      Serial.print(values[i]);    // Let the user see it now.
      Serial.print('\t');         // Make it pretty.
    } else {
      Serial.print("Overflow\t");
    }
    token = strtok(NULL,"\;");  // Grab a token from the string.
    i++;
  }                             //
  Serial.println();             // Setup for next string.
}


// For now all we need is idle for the port manager.
void loop() { idle(); }