Skip to content

Instantly share code, notes, and snippets.

@facchinm
Created March 16, 2015 09:33
Show Gist options
  • Save facchinm/e65f85efd1103441cc44 to your computer and use it in GitHub Desktop.
Save facchinm/e65f85efd1103441cc44 to your computer and use it in GitHub Desktop.
Leonardo USB to Serial converter
/*
leo_usb2serial
Allows to use an Arduino Leonardo as an usb to serial converter.
*/
void setup() {
Serial.begin(115200);
Serial1.begin(115200);
}
void loop() {
// copy from virtual serial line to uart and vice versa
if (Serial.available()) {
char c = (char)Serial.read();
Serial1.write(c);
}
if (Serial1.available()) {
char c = (char)Serial1.read();
Serial.write(c);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment