Created
December 6, 2015 00:46
-
-
Save ocihangir/e6deb73404bbd10fd6fc to your computer and use it in GitHub Desktop.
This code converts Arduino Leonardo into a USB to UART converter
This file contains hidden or 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
| /* | |
| * This code converts Arduino Leonardo into a USB to UART converter | |
| */ | |
| int incomingByte = 0; | |
| void setup() { | |
| // initialize serial: | |
| Serial.begin(9600); | |
| while (!Serial) { | |
| ; // wait for serial port to connect. Needed for Leonardo only | |
| } | |
| Serial1.begin(9600); | |
| } | |
| void loop() { | |
| if (Serial1.available() > 0) | |
| { | |
| incomingByte = Serial1.read(); | |
| Serial.write(incomingByte); | |
| } | |
| if (Serial.available() > 0) | |
| { | |
| incomingByte = Serial.read(); | |
| Serial1.write(incomingByte); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Ozan
I am trying to use you code for uploading a sketch to an ESP32-Cam, with help of a Leonardo, without success.
Would you mind having a look? I am a newbie and may have made a simple mistake, which you may be able to recognize from the first glance.
I have created an Arduino Forum post.
Any help would be greatly appreciated.