I\'m actually reposting a question from the iphone development boards. I didn\'t ask it, but I found it when trying to find its answer. Nobody had yet responded there, so I th
If you don't want to use the trueHeading
value, and assuming that the compass lies perfectly horizontal, the heading can be computed this way:
(these are from http://www.magneticsensors.com/datasheets/an203.pdf)
... plus the heading must be corrected for Magnetic deviation and Magnetic declination
in case the compass is not horizontal, you should use only the horizontal component (you can not ignore the z axis) by projecting the (x, y, z) vector to a plane that is parallel to the earth surface and then compute the heading from this projected x and y.
Hope it helps.