msCompassHeading (Function) |
Top Previous Next |
This function takes the measured magnetometer readings in the plane perpendicular to the axis passing through the center of the earth and the RTCU device and gives a measure for magnetic north, also called Compass Heading. Returned value is in degrees.
The measured compass heading follows the rules: •If the result is greater than 337.25° or less than 22.5° – North •If the result is between 22.5° and 67.5° – North-East •If the result is between 67.5° and 112.5° – East •If the result is between 112.5° and 157.5° – South-East •If the result is between 157.5° and 202.5° – South •If the result is between 202.5° and 247.5° – South-West •If the result is between 247.5° and 292.5° – West •If the result is between 292.5° and 337.25° – North-West
Input: MagX : FLOAT The measured magnetometer reading on the X-axis.
MagY : FLOAT The measured magnetometer reading on the Y-axis.
Returns: FLOAT The measure for the compass heading in the range [0.0° - 360.0°[
Declaration: FUNCTION msCompassHeading : FLOAT;
Example: INCLUDE rtcu.inc heading : FLOAT; |