even better:
void setup()
{
Serial.begin(9600, SERIAL_8N1); //USB-Prog. Port
Serial1.begin(9600, SERIAL_8N1); //Serial Device
Serial.setTimeout(500);
Serial1.setTimeout(50);
}
void loop()
{
if (Serial1.available() > 0) {
String command = Serial1.readString();
command.trim();
if (command == "routine1"){
Serial.println("received-a");
command = "0";
}
if (command == "routine2"){
Serial.println("received-b");
command = "0";
}
else {
//do nothing.. for the moment :)
}
}
}