H3LIS331DL will not switch to high range

I am trying to use my H3LIS331DL in the 400g high range but no matter what I do it will not come out of the low range

https://www.sparkfun.com/products/14480

this is my setup code I hardley modified from that on the info page:

Wire.begin();

xl.setI2CAddr(0x19);

xl.begin(LIS331::USE_I2C);

xl.setFullScale(LIS331::HIGH_RANGE); // no matter what i change this value to it does not change the accelerometer’s output.

xl.setPowerMode(LIS331::NORMAL);

xl.setODR(LIS331::DR_50HZ);

this is my loop if it makes a difference:

xl.readAxes(x, y, z);

Serial.println(y);

Serial.print("y: ");

Serial.println(xl.convertToG(400,y)); //because it is still in the low range the 400 max value makes it output 4x what it should, it outputs propper readings when it is set to 100, showing it is still in the low range

delay(1000);

thank you for any help you can offer

could the high range only work in SPI mode?

It sounds like you are having better luck than me.

What board are you using?

Did you try switching it to SPI mode yet? How did that work out?

Hi everyone,

It looks like this issue was addressed with a [pull request to the GitHub repository but a new version of the library was not pushed to Arduino so if you used the Arduino library manager to install the LIS331 Arduino Library, that is most likely what is causing the issue. I am going to ping the engineer for that library about this issue and a new version should be pushed to Arduino soon but if you want to do it manually, I will outline a few options for how to do that below.

The [fix to the issue is a simple line edit so you could either navigate to the CPP file on your computer(s) and either edit that line or replace the old CPP file with the new, correct one. Another, possibly easier option may be to re-install the library manually by navigating to your Arduino/Libraries folder and deleting the folder, then download the library from the [GitHub Repository and finally either manually install it after unzipping it in the Arduino/Libraries folder or using the ZIP library installer tool in Arduino.

Just a quick note about manually installing an unzipped library from GitHub, usually the unzipping tool will create a second “master” folder that just opens to the actual master folder. Make sure the master library folder you drop into the Arduino/Libraries folder opens directly to the “Examples” and “SRC” folders as well as the other files (license, README, etc.).

This should fix the issue but if any of you still have problems with that scale setting or need help installing the library manually, let me know and I would be happy to help as much as I can.](GitHub - sparkfun/SparkFun_LIS331_Arduino_Library: Arduino library for LIS331 family accelerometers.)](Fix bug regarding the setFullScale function on the H3LIS331DL & LIS3DH by dHutchings · Pull Request #2 · sparkfun/SparkFun_LIS331_Arduino_Library · GitHub)](Fix bug regarding the setFullScale function on the H3LIS331DL & LIS3DH by dHutchings · Pull Request #2 · sparkfun/SparkFun_LIS331_Arduino_Library · GitHub)