// serialStr manages a serial port for you. When it recieves a
// complete string, it calls your choosen function to deal with it.
// And, it does all this, NON-BLOCKINGLY.
//
// Hide the mess of millis!
//
#include <serialStr.h>
serialStr serialManager;
void setup() {
Serial.begin(115200);
Serial.println("Type command and number.");
serialManager.setCallback(gotCom);
}
void gotCom(char* inStr) {
char instruction[20];
int magnitude;
sscanf(inStr, "%s %d", instruction, &magnitude);
Serial.print("Instruction: ");Serial.println(instruction);
Serial.print("Magnitude: ");Serial.println(magnitude);
}
void loop() { idle(); }