jecrespo
12/4/2017 - 5:30 PM

Arduino Read Serial Snippet

Arduino Read Serial Snippet

void setup() {
  Serial.begin(9600);
}

void loop() {
  if (Serial.available() > 0) {
    String buffer = ""; //empty buffer
    do {
      char c = Serial.read();
      delay(5);
      buffer += c;
    }  while (Serial.available() > 0);
    Serial.println("String readed from Serial: \"" + buffer + "\"");
  }
}