Arduino Uno Strucks Randomly

I Modified it to the following to get a serial message

    while (fifoCount < packetSize) {
      fifoCount = mpu.getFIFOCount();
      Serial.println(F("waiting for fifo count"));
    }