You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Glad you got something working! Just some extra info if it helps:

    • mag.x/y/z are the raw magnetic field strength values from the magnetometer, which can have some offset
    • mag.dx/dy/dz are the 'calibrated' field values - after the magnetometer is on and you move around a bit, it works out the maximum and minimum values, then gives you dx/dy/dz relative to the center of that bounding box. That's what the heading value works from.

    So if you want to work out the actual rotation, with the Bangle still and after you've rotated it around a bit to calibrate the magnetometer, you should be able to:

    • Treat acc.x/y/z as a vector pointing downwards
    • Treat mag.dx/dy/dz as a vector pointing towards north (or south? can't remember)
    • Then the cross-product of those two vectors points east/west
About

Avatar for Gordon @Gordon started