Skip to content

Instantly share code, notes, and snippets.

@volca
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save volca/adf8df85b0cc94a3d39a to your computer and use it in GitHub Desktop.
Save volca/adf8df85b0cc94a3d39a to your computer and use it in GitHub Desktop.
String tmp;
void setup() {
Serial.begin(115200);
Serial1.begin(115200);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
Serial.println("hello!");
};
void loop() {
while (Serial1.available() > 0) {
tmp += char(Serial1.read());
delay(2);
}
if(tmp.length() > 0) {
Serial.println(tmp);
tmp = "";
}
if (Serial.available()) {
Serial1.write(Serial.read());
}
delayMicroseconds(10);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment