I saw two different methods of requesting the data from I2C bus:
Method 1:
Wire.beginTransmission(MPU);
Wire.write(0x43); // Gyro data first register address 0x43
Wire.endTransmission(false);
//https://www.arduino.cc/en/Reference/WireEndTransmission
//false will send a restart, keeping the connection active.
Wire.requestFrom(MPU, 6, true); // Read 4 registers total, each axis value is stored in 2 registers
GyroX = (Wire.read() << 8 | Wire.read()) / 131.0; // For a 250deg/s range we have to divide first the raw value by 131.0, according to the datasheet
GyroY = (Wire.read() << 8 | Wire.read()) / 131.0;
GyroZ = (Wire.read() << 8 | Wire.read()) / 131.0;
Method 2:
Wire.beginTransmission(0b1101000); //I2C address of the MPU //Accelerometer and Temperature reading (check 3.register map)
Wire.write(0x3B); //Starting register for Accel Readings
Wire.endTransmission();
Wire.requestFrom(0b1101000,8); //Request Accel Registers (3B - 42)
while(Wire.available() < 8);
accelX = Wire.read()<<8|Wire.read(); //Store first two bytes into accelX
accelY = Wire.read()<<8|Wire.read(); //Store middle two bytes into accelY
accelZ = Wire.read()<<8|Wire.read(); //Store last two bytes into accelZ
temp = Wire.read()<<8| Wire.read();
It appeared that the first method did not terminate the transmission, i.e. Wire.endTransmission(false) while the second one was not specified. What's the difference between them? and which one is better, i.e. response time/loop time.
Also, does
0b1101000 and 0x3B(the register address for Accel in Method 2)
equal to each other?