So I just take the x,y,z values from here:
http://code.bildr.org/download/959.zip
and plug them into here directly? Combining the 2 sketches.
Yes, that is correct. Raw values or scaled doesn't matter, raw is faster and more accurate.
In process, the library scales everything up with an equal multiplier to reduce quantization losses.
sixDOF.compCompass(-(raw.ZAxis), -(raw.XAxis), raw.YAxis, -(accel.z()), -(accel.x()), accel.y(), true);
Mine are raw values also?
Why do the first 2 - Z,X have minus signs, Y does not?
Do I include these signs before my x,y,z too?
You may want to play with the arrangement and sign of xyz depending on the orientation of your accelerometer and compass.
My PCB is mounted vertically and the xy of the accelerometer was not the same as the xy of the compass.
This is why I have (-z, -x, +y). The default order is (+x, +y, +z).
I don't see how this can work for small tilt angles, because the Z value doesn't change, in my case.
Can you explain how it works without this value?
Let's say you have tilt and X,Y from HMC5883, but no Z.
The libraries trigonometry is non-linear and ratiometric.
Non-linear as in on axis effect is the lowest, while a right angle axis will have the highest effect.
Ratiometric as in a change in only one axis effects the ratio and therefore the end result.