I have an Arduino UNO R3 and I'm using the I2C to communicate with a magnetometer (HMC5883L) and an accelerometer (ADXL345).
An eCompass made with the HMC5883L only works fine into a plane terrain, If you tilt to top or to botton some error is added to the read. So the ADXL345 is used to do this compensation.
Resuming, I wanna a compass that do not change the orientation when pointing up or down.
I wanna the done code, from someone that did this earlier.