Created
September 4, 2014 06:51
-
-
Save johnboiles/17d5949de771c7b9b918 to your computer and use it in GitHub Desktop.
Super simple Arduino serial echo from one serial port to another
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
void setup() | |
{ | |
while (!Serial) { | |
; // wait for serial port to connect. Needed for Leonardo only | |
} | |
// Leotracker has connection to the gps power pin | |
pinMode(8, OUTPUT); | |
digitalWrite(8, LOW); | |
// start serial port at 9600 bps: | |
Serial.begin(9600); | |
Serial1.begin(9600); | |
} | |
void loop() | |
{ | |
if (Serial.available() > 0) { | |
Serial1.write(Serial.read()); | |
} | |
if (Serial1.available() > 0) { | |
Serial.write(Serial1.read()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment