dr pepper
Advanced Member level 1
I'd like to use a 5883 magnetometer to calculate a compass heading in degrees using the X and Y values.
The math I was thinking of is:
arctan (x/y) , where x and y are the magnetometer readings.
This gives me an angle within 90 degrees, to work out which quadrant I'm in I was thinking of just looking at the + and - sign of the x and y readings, and adding 90,180 or 270 degrees.
Piclist have a handy routine I can cut/paste to do the arctan of a fraction.
Does this sound like an effective approach?
The math I was thinking of is:
arctan (x/y) , where x and y are the magnetometer readings.
This gives me an angle within 90 degrees, to work out which quadrant I'm in I was thinking of just looking at the + and - sign of the x and y readings, and adding 90,180 or 270 degrees.
Piclist have a handy routine I can cut/paste to do the arctan of a fraction.
Does this sound like an effective approach?