Skip to content

What units getX() are the values ​​in? #36

@brightproject

Description

@brightproject

The pseudocode is like this

QMC5883LCompass compass;

int x = compass.getX();
int y = compass.getY();
int z = compass.getZ();

int azim;

char buffer[100]; // Increase the buffer size to accommodate the entire string
snprintf(buffer, sizeof(buffer), "X: %.2d, Y: %.2d, Z: %.2d", x, y, z);
Serial.println(buffer);

snprintf(buffer, sizeof(buffer), "Azimut: %.2d", azim);
Serial.println(buffer);

https://github.com/mprograms/QMC5883LCompass?tab=readme-ov-file#example-output

Are these raw values ​​or uTesla or microHenry?

With these settings in my code

compass.setMode(0x01, 0x0C, 0x10, 0x00);

MODE CONTROL (MODE)
	Standby			0x00
	Continuous		0x01

OUTPUT DATA RATE (ODR)
	10Hz        	0x00
	50Hz        	0x04
	100Hz       	0x08
	200Hz       	0x0C

FULL SCALE (RNG)
	2G          	0x00
	8G          	0x10

OVER SAMPLE RATIO (OSR)
	512         	0x00
	256         	0x40
	128         	0x80
	64   

The resulting data is:
X: -316 Y: 62 Z: -1883
Azimut: 78

Azimuth is calculated in degrees from 0 to 360.
What are the units of measurement for x, y, and z?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions