String msg; void setup() { Serial.begin(115200); // Start serial communication while (!Serial); // Wait until Serial is open } void loop() { while (Serial.available()) { # Read a line delay(3); //delay to allow buffer to fill if (Serial.available() > 0) { char c = Serial.read(); //gets one byte from serial buffer msg += c; //makes the string readString } } if (msg != ""){ Serial.println("Echo: " + msg); // Print an echo msg = ""; # Reset the received message } }