diff --git a/imu.ino b/imu.ino index 1c5e8bc..0d8d273 100644 --- a/imu.ino +++ b/imu.ino @@ -135,8 +135,9 @@ void readSensor() { Wire.endTransmission(); // End the transmission Wire.requestFrom(MPU_ADDRESS, 14); // Request 14 bytes from the MPU-6050 - // Wait until all the bytes are received - while (Wire.available() < 14); + if (Wire.available() == 0) { + // That means MPU is not connected + } acc_raw[X] = Wire.read() << 8 | Wire.read(); // Add the low and high byte to the acc_raw[X] variable acc_raw[Y] = Wire.read() << 8 | Wire.read(); // Add the low and high byte to the acc_raw[Y] variable