Last active
September 21, 2018 17:32
-
-
Save monkbroc/88ca591063e2420a3fb761769c87931f to your computer and use it in GitHub Desktop.
Particle Photon USB to UART passthrough
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
/* Pass through all data from USB serial to UART serial (TX/RX pins) | |
*/ | |
SYSTEM_THREAD(ENABLED); | |
SYSTEM_MODE(MANUAL); | |
void setup() { | |
Serial1.begin(9600); | |
Serial.begin(); | |
} | |
void loop() { | |
while (Serial1.available()) { | |
Serial.write(Serial1.read()); | |
} | |
while (Serial.available()) { | |
Serial1.write(Serial.read()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment