

Hi, I've been trying to figure out a way to calculate the orientation (both azimuth and altitude) of my Bangle using both the accelerometer and the magnetometer. The altitude was easy; I just multiply 90ยบ by the accelerometer's Z value. However, to calculate the azimuth is proving to be trickier. I've tried reading the magnetometer's values at several orientations (the values mag.x, mag.y, mag.z, mag.dx, mag.dy, and mag.dz) but don't understand what they mean. Could someone please explain them to me so I can transform them into a vector to calculate the azimuth? Thanks for the help!


Thanks, that works! At least, when the Bangle's lying flat. Now I'd like to still get the right angle whatever way the watch is oriented. I'm supposing I could use the accelerometer to find out where down is, and use that to rotate the magnetometers' vector... I don't know if I'm even making sense.