void loop() { if (Serial.available()) { digitalWrite(13, HIGH); } else { digitalWrite(13, LOW); } // put your main code here, to run repeatedly: while (Serial.available()) { delay(3); //delay to allow buffer to fill if (Serial.available() > 0) { char c = Serial.read(); //gets one byte from serial buffer readString += c; //makes the string readString } } // handle commands, if any detected // if not, repeat what was sent if (readString != "" && Serial.available() <= 0) { if (readString == "/hello") { // handle the '/hello' Serial.println("Hi there, Master!"); } else { // repeat what was said Serial.println(readString); readString = ""; } } }