adafruit / Adafruit-Raspberry-Pi-Python-Code

Adafruit library code for Raspberry Pi
1.43k stars 686 forks source link

order of magnetic sensor reading of LSM303 #124

Closed Azz1 closed 9 years ago

Azz1 commented 9 years ago

Looks like the reading of magnetic sensor is in X, Z, Y order instead of X, Y, Z. Not a big issue :-)

... Adafruit/Adafruit_LSM303.py res.append((self.mag16(list, 0), # X self.mag16(list, 2), # Z self.mag16(list, 4), # Y 0.0 )) # ToDo: Calculate orientation

microbuilder commented 9 years ago

This is consistent with the chip. The accelerometer outputs XYZ data but the magnetometer outputs XZY (see the Arduino driver by way of comparison): https://github.com/adafruit/Adafruit_LSM303DLHC/blob/master/Adafruit_LSM303_U.cpp#L291