Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int CurrentHeading(int GPSheading,int MagHeading,int numPixels) {
- // Define total number of degrees
- int degrees = 360;
- if( GPSheading > MagHeading ) {
- int heading=GPSheading-MagHeading; // Subtract GPS Heading from Magnetometer heading
- heading=heading/degrees; // Divide by 360 to get value to multiply the number of pixels by
- heading=heading*numPixels; // Multiply by number of pixels
- return heading; // return final heading
- }
- else if( GPSheading < MagHeading ) {
- int heading=MagHeading-GPSheading;
- heading=degrees-heading;
- heading=heading/degrees;
- heading=heading*numPixels; // Multiply by number of pixels
- return heading; // return final heading
- }
- else {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement