data Error_accelerometer

Hi All

I am working with ADXL 345 accelerometer with RFduino. I have programmed it for ±2g range using I2C. To convert raw data into G I am using G=rawdata*(4/2^10). To show the +1g it works fine but when I tilt other side it shows 255 instead of -1.

I am reading raw data and storing it into “int” data type variable. I tried unsigned int and signed int. but the issue stays the same. Can anyone help me out with this problem.

ADXL345_LED.ino (4.25 KB)

The code you posted does not appear to be the code you are describing.


is not to found. In any case, this would produce only integer values from -2 to 2.