EDIT: I2C Communication Setup with Arduino Mega and Razor IMU

Right, so I'm just trying to read in the data from my IMU using an I2C connection. I can get the data over serial with

//Connect IMU to TX1 and RX1 and then connect RX0 to TX1 and steal the data

String sensorData;
char c;
void setup() {
  Serial.begin(57600);
  Serial1.begin(57600);
  Serial.println("9DOF Test"); 
}
  
void loop() {

  while (Serial1.available()) {  
    if (Serial1.available() >0) {
  c = Serial1.read(); 
  //sensorData += c; //adds c to the sensorData string
       Serial1.print(c); //see whatever came in on Serial.read()
    }
  }
  while (Serial.available()) {  
    if (Serial.available() >0) {
  c = Serial.read(); 
  //sensorData += c; //adds c to the sensorData string
       Serial.print(c); //see whatever came in on Serial.read()
    }
  }
  
  if (sensorData.length() >0) {
   Serial.println(sensorData);  //output the string
//readString=""; //resets reString for the next iteration of the loop
  } 
}

However, I found the code here razor-9dof-ahrs/Arduino/Razor_AHRS at master · Razor-AHRS/razor-9dof-ahrs · GitHub (which consists of six tabs so I won't post it all unless you want me to). Anyway, this code handles all of the calibration and math that I would need to implement so I was going to try to just use it instead. The code I posted in my last post was the part of the code which reads in data from the IMU. Now, this is probably where my unfamiliarity with I2C made helping me difficult. The IMU has TX and RX pins on it so I assumed I needed to use TX and RX from my Arduino even though the code uses I2C and not Serial. I know from the datasheets that the IMU can be used with I2C.

I guess this all boils down to ask how I should connect my Arduino to my IMU to utilize an I2C connection (as used by the code found on github) even though the only six pins on the IMU are GND, 3.3V, DTR, CTS, TX0, and RX1. As of now (when I hooked up my IMU using the TX and RX pins of the Arduino and IMU), the Arduino is not receiving data from the IMU. I suppose this is because you can't do an I2C connection over the Arduino's TX and RX pins.

So any help or direction would be greatly appreciated. Thanks again and let me know if you need any more information.



EDIT: There are also six AVR SPI pins. As your signature says, reading documentation helps. I didn't understand before, but I think I'm on the right track now. On page 10 of the datasheet (found here: https://www.sparkfun.com/datasheets/Sensors/Accelerometer/ADXL345.pdf), it gives a I2C connection diagram where not CS is connected to VDD I/O, SDA is connected in parallel to a processor's D in/out and to a resistor that is connected in series with VDD I/O, Alt address is grounded, and SCL is connected in parallel to D out and a resistor that is connected in series with VDD I/O.

The alternative address for a grounded alternative address pin matches the one used in the program I found. According to the IMU's documentation, the CS pin is already set to 3.3V so I should be good there. So do all I need to do is connect the SDA to one of the digital pins on the Arduino for input, and connect the SCL to another digital pin for output? I don't see the Alt address pin of the acclerometer on the IMU's schematic, but could this be the SD0 pin?

Also, the accelerometer's I2C connection diagram (found here: http://cdn.sparkfun.com/datasheets/Sensors/IMU/9DOF-Razor-v22.pdf) specifies using resistors to connect the SDA and SCL to the VDD I/O. In the IMU's schematic, these outputs are not shown to have resistors. This may be a very ignorant question, but it's a safe bet that the resistors were not included with the IMU's wiring (even though it seems it has the CS and Alt Address pins connected where they need to be), correct?

The address for writing is 0xA6 and the I2C address is 0x53. The I2C address is exactly half of the writing address, is this a coincidence?

For clarification, the IMU contains three sensors. The accelerometer, the magnetometer, and the gyroscope. That is, the accelerometer and IMU are distinct.