磁気センサv4
Dependencies: mbed
Fork of mag_sensor by
Revision 6:eeef849dd7a1, committed 2018-08-14
- Comitter:
- ponpoko1939
- Date:
- Tue Aug 14 14:13:56 2018 +0000
- Parent:
- 5:7eb3b7e56eb1
- Commit message:
- ver4.1.1
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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; } }