SparkFun Forums 

Where electronics enthusiasts find answers.

Questions &/or issues related to products in the Movement & IMU category should be posted in this forum.
#202282
Hi,

I am using this with an Arduino. I am using the library from https://github.com/sparkfun/SparkFun_LI ... no_Library.

I can run the example given but when I try to change some setting in the registers, I am not successful.

I tried to change the full scale range from +/-6 g to +/-12 g and +/-24 g and the output was just wrong.

I could not find any reference to this library on your website, is it one you still recommend or support.
#202335
I had a similar problem so I ditched the library, got out the data sheet, and learned how to read/write the registers. Here is a quick sample on setting the range and reading the register to make sure it contains what you wish. Have spent many hours working with this unit - will try to help if I can.
Code: Select all
 // Write to CTRL_REG4 register located at 0x23 to set Full Scale and some defaults
  // 1xxxxxxx Set most significant bit to one to avoid updating data registers between reading the MSB and LSB of data
  // x0xxxxxx Bit for selecting big or little endian - default is 0
  // xx00xxxx Sets full scale to low range
  // xx01xxxx Sets full scale to mid range
  // xx11xxxx Sets full scale to high range
  // xxxx0000 Default values
   Wire.beginTransmission(HH);  // Talk to the 331HH
   Wire.write(0x23);  //Writes the address of the register
   // Use only one of the following three statements - this assumes most signifcant bit is 1 and lower four bits are 0
    Wire.write(0x80);  //Set Range to LOW 
    //Wire.write(0x90);  //Set Range to MED
    //Wire.write(0xB0);  //Set Range to HIGH 
   Wire.endTransmission(false); // false causes a restart to be sent
   
 // Read CTRL_REG4 register
   Wire.beginTransmission(HH);  // Talk to the 331HH
   Wire.write(0x23);  //Writes the address of the register   
   Wire.endTransmission(false); // false causes a restart to be sent
   Wire.requestFrom(HH, 1);  // Request 1 byte
   if (Wire.available() > 0){
     Serial.print("CTRL_REG4:  ");
     Serial.println(Wire.read(), HEX); // Print the contents of the register
   }
   else
   {
      Serial.println("No data received");
   }  // End of if