Lsm303d jumble acc and mag data

Hello, i am niewbie in arduino.
Try to use lsm303d module for create tilt compansation compass.
But data from module wrong. When i rotate module relativetly horizont ,range of azimut - 150 - 230 and back.
When rotate relatively X (like grill) data range - 0-360.
Thanks for you help!
P.s. libary from pololu.


I am sorry you are having an issue using our LSM303 library. I’m not sure I understand your problem. If you are using our Heading example, the direction indicated should be the positive X axis by default (unless you have edited the sketch). If you are not getting the behavior you expect, could you verify that you have calibrated the magnetometer? If so, what are your calibration values?


Thx for your attention!

compass.m_min = (LSM303::vector<int16_t>){ -3600, -2483, -2821};
compass.m_max = (LSM303::vector<int16_t>){ +2649, +2801, +2494};

Those values seem okay. Can you tell me more about your setup? Which Arduino are you using? How are you supplying power to the LSM303D? I would like to see the environment that your sensor is operating in; can you share a link to a video that shows the sensor running the Heading sketch? Can you also confirm that besides updating the six magnetometer values, you have not edited the Heading sketch?