Skip to content

Instantly share code, notes, and snippets.

@volca
Created December 2, 2014 07:32
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 volca/9f8afd841ac88db4967a to your computer and use it in GitHub Desktop.
Save volca/9f8afd841ac88db4967a to your computer and use it in GitHub Desktop.
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