Skip to content

Instantly share code, notes, and snippets.

@jenschr
Created November 21, 2016 08:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jenschr/fe8ac8ba3e162e8521b435c2c99a699f to your computer and use it in GitHub Desktop.
Save jenschr/fe8ac8ba3e162e8521b435c2c99a699f to your computer and use it in GitHub Desktop.
#include <SoftwareSerial.h>
// RX,TX on Arduino
SoftwareSerial mySerial(8, 9);
void setup()
{
Serial.begin(38400);
mySerial.begin(38400);
}
void loop()
{
/* send everything received from the hardware uart to usb serial & vv */
if (Serial.available() > 0) {
Serial.print("Sent: ");
while( Serial.available() > 0 ){
char ch = Serial.read();
Serial.print(ch);
mySerial.print(ch);
}
}
if (mySerial.available() > 0) {
char ch = mySerial.read();
if( ch ){
Serial.print(ch);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment