This document explains in great detail how to use an accelerometer+magnetometer to create a tilt-compensated compass: http://cache.freescale.com/files/sensors/doc/app_note/AN4248.pdf There are simpler approaches than those described, though.
This document explains in great detail how to use an accelerometer+magnetometer to create a tilt-compensated compass: http://cache.freescale.com/files/sensors/doc/app_note/AN4248.pdf There are simpler approaches than those described, though.