• The code posted above does a calculation called level and that uses the accelerometer in the chip I'm using, not the magnetometer. Sorry about that.
    The code expects -Z to be down and if +Y points North the heading is 0.0 degrees.
    You may need to swap the axis in the formulas if you want to orient the Puck differently

About