Skip to content

Instantly share code, notes, and snippets.

@ca4ti
Forked from facchinm/leo_usb2serial
Created August 6, 2021 01:12
Show Gist options
  • Save ca4ti/d9427807cdce3a12dad3e4df05db07da to your computer and use it in GitHub Desktop.
Save ca4ti/d9427807cdce3a12dad3e4df05db07da 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