m2h function

Heading from accelerometer and magnetometer data