Go Down

Topic: Grove I2C 3-axis Accelerometer troubles (Read 902 times) previous topic - next topic



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.


Apr 23, 2012, 06:23 pm Last Edit: Apr 23, 2012, 06:26 pm by MarkT Reason: 1
Please use code tags for code.  (The # button when composing a posting)

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

That code will call Wire.read() when nothing is available to read.   You are not guarding the calls to read() properly.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Go Up