Skip to content

Instantly share code, notes, and snippets.

@jecrespo
Last active December 4, 2017 18:07
Show Gist options
  • Save jecrespo/6f500126015adc999dd8d466be0e2c0f to your computer and use it in GitHub Desktop.
Save jecrespo/6f500126015adc999dd8d466be0e2c0f to your computer and use it in GitHub Desktop.
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 + "\"");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment