Created
November 21, 2016 08:03
-
-
Save jenschr/fe8ac8ba3e162e8521b435c2c99a699f to your computer and use it in GitHub Desktop.
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
#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