-
-
Save ca4ti/d9427807cdce3a12dad3e4df05db07da to your computer and use it in GitHub Desktop.
Leonardo USB to Serial converter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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