#include <QMC5883LCompass.h>
QMC5883LCompass compass;
void setup() {
Serial.begin(9600);
compass.init();
}
void loop() {
int x, y, z;
// Read compass values
compass.read();
// Return XYZ readings
x = compass.getX();
y = compass.getY();
z = compass.getZ();
Serial.print(" ");
Serial.print(x);
Serial.print(" ");
Serial.print(y);
Serial.print(" ");
Serial.print(z);
Serial.println();
delay(100);
}
This is something you should look at. I think this gives the xyz raw values.
reference: QMC5883LCompass/xyz.ino at master · mprograms/QMC5883LCompass · GitHub