磁気センサv4

Dependencies:   mbed

Fork of mag_sensor by Funai Ryotaro

Revision:
6:eeef849dd7a1
Parent:
5:7eb3b7e56eb1
--- a/main.cpp	Tue Aug 14 14:07:45 2018 +0000
+++ b/main.cpp	Tue Aug 14 14:13:56 2018 +0000
@@ -84,6 +84,7 @@
         rad = atan2(magZ * sin(roll) - magY * cos(roll), magX * cos(pitch) + magY * sin(pitch) * sin(roll) + magZ * sin(pitch) * cos(roll));
         degree = -((int)(rad * 180.0 / 3.141592 + 270.0 - 8.34) % 360 - 360.0);
         pc.printf("%d\n\r",(int)degree);
+        return (int)degree;
     }
 }