serial on different pins than 0 or 1

Very cool! We've been trying to get this working for a long time.

By using a faster baud rate to send data back to the computer from the Arduino board, I was able to almost handle file transfers. I also cleaned up the code a bit. Here it is:

#define BAUDRATE 9600

// the width of a single bit of serial data in microseconds
// in each second (1000000 microseconds) there are a number of bits equal
// to the baud rate (e.g. 9600), so each bit lasts for 1000000 / baudrate
// microseconds
int width = 1000000 / BAUDRATE;
int fudge = -25;
int rx = 6;

void setup() {
  Serial.begin(115200);
  pinMode(rx,INPUT);
  digitalWrite(13,HIGH);
}

void loop() {
  int val = 0;
  
  // one byte of serial data (LSB first)
  // ...--\    /--\/--\/--\/--\/--\/--\/--\/--\/--...
  //       \--/\--/\--/\--/\--/\--/\--/\--/\--/
  //      start  0   1   2   3   4   5   6   7 stop

  while (digitalRead(rx));

  // confirm that this is a real start bit, not line noise
  if (digitalRead(rx) == LOW) {
    // frame start indicated by a falling edge and low start bit
    // jump to the middle of the low start bit
    delayMicroseconds(width / 2);
    
    // offset of the bit in the byte: from 0 (LSB) to 7 (MSB)
    for (int offset = 0; offset < 8; offset++) {
      // jump to middle of next bit
      delayMicroseconds(width + fudge);
      
      // read bit
      val |= digitalRead(rx) << offset;
    }
    
    delayMicroseconds(width + fudge);

    Serial.print(val, BYTE);
    
    val = 0;
  }
}