Grove I2C 3-axis Accelerometer troubles

Hello,

I'm trying to use the Grove I2C 3-axis accelerometer with Arduino UNO (sketch and phtoto is in the attachment).
It works fine for several iterations (usually about 100-200)
Then it stops sending data. =(

I've tryed to use accelerometer with and without pull-up resistors, but result is exactly the same.'

Where is the root of the problem?

Thanks for advance.

accel.ino (1.77 KB)

Please use code tags for code. (The # button when composing a posting)

  while(Wire.available()) {
    if(count < 3) {
      while ( val[count] > 63 )  // reload the damn thing it is bad
      {
        val[count] = Wire.read();
      }
      count++;
    }
  }

That code will call Wire.read() when nothing is available to read. You are not guarding the calls to read() properly.