Closed BrentSeidel closed 8 years ago
Close re-reading of the data sheet shows that the acceleration values are two byte values with the LSB in the lower addressed register (i.e. for x-acceleration the LSB is in address 16#28# while the MSB is in 16#29#). On the other hand, the magnetometer values are reversed (i.e. x-magnetomer has LSB in address 16#04# and MSB in 16#03#). The software was written assuming that both were the same.
Change the read function for uint16 in the i2c package to two functions: readm1 and readm2 for MSB first and MSB second reads. Updated L3GD20H and LSM303DLHC packages to use the new routines where appropriate. Things should work now with the latest commit, but as always, no guarantees.
The outputs from the LSM303DLHC are often outside the expected range of +/-1.3 Gauss. The accelerometer readings on the other hand are sensible.