Skip to content

Instantly share code, notes, and snippets.

@bmatusiak
Last active January 28, 2021 17:41
Show Gist options
  • Select an option

  • Save bmatusiak/e7adebfe2f65ca6475e2cbcd51ec9e74 to your computer and use it in GitHub Desktop.

Select an option

Save bmatusiak/e7adebfe2f65ca6475e2cbcd51ec9e74 to your computer and use it in GitHub Desktop.
uint32_t baud;
uint32_t old_baud;
void loop() {
// put your main code here, to run repeatedly:
baud = Serial.baud();
if (baud != old_baud) {
SerialTTL.begin(baud);
while (!SerialTTL);
old_baud = baud;
}
if (Serial.available() > 0)
{
char c = Serial.read();
SerialTTL.write(c);
}
if (SerialTTL.available() > 0) {
char c = SerialTTL.read();
Serial.write(c);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment