Wire.endTransmission doesn't return

I have a MPU6050 6 axis gyro and accelerometer connected to a Arduino Nano via the i2c bus. I'm using the I2Cdev library. For the most part this works great. However I want to make by software work better in the event of hardware failure. If something were to happen to the gyro I want the rest of the application to continue to function a sensible way.

The problem I have is that if the gyro is not connected then the initialise doesn't return. I traced this to the readbytes function in the I2Cdev library and a call to Wire.endTransmission. Looking at the reference page for Wire.endTransmission I would expect to get a error code back.

Does anyboday else have any experience with this?

Cheers
Alex

Hi Alex

Maybe this is the same as the code you already tried? If not, see if it behaves differently.

boolean i2cDeviceAtAddress(uint8_t address)
{
	Wire.beginTransmission(address);
	return (Wire.endTransmission() == 0);
}

Regards

Ray