Created
December 2, 2014 07:32
-
-
Save volca/9f8afd841ac88db4967a to your computer and use it in GitHub Desktop.
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
byte inbuff[255]; | |
byte outbuff[255]; | |
#define rate 115200 | |
void setup() { | |
Serial.begin(rate); | |
while (!Serial) ; | |
Serial1.begin(rate); | |
while (!Serial1); | |
delay(500); | |
Serial.println("I'm ready for update."); | |
} | |
void loop() { | |
int i=0,x=0; | |
while (Serial.available()) { | |
inbuff[i]=Serial.read(); | |
i++; | |
} | |
for(x=0;x<i;x++){ | |
Serial1.write(inbuff[x]); | |
} | |
int j=0; | |
while (Serial1.available()) { | |
outbuff[j]=Serial1.read(); | |
j++; | |
} | |
for(x=0;x<j;x++){ | |
Serial.write(outbuff[x]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment