調整中
Dependencies: mbed HMC6352 US015 TB6612FNG2 getGPS ATP3011
AngleGet.h
- Committer:
- user_
- Date:
- 2021-10-27
- Revision:
- 13:38c5ffe5873a
- Parent:
- 9:9221ef8d36a8
File content as of revision 13:38c5ffe5873a:
#include "HMC6352.h" #include "math.h" #include "getGPS.h" //#include <math.h> #define M_PI 3.14 // とりあえず円周率を定義 Serial pc(USBTX, USBRX); HMC6352 compass(D4, D5); GPS gps(D1, D0); int AngleGet() { while(1) { double angle; compass.setOpMode(HMC6352_CONTINUOUS, 1, 20); angle = compass.sample() / 10; double next_x; double next_y; double theta; double delta; //if(gps.getgps()) { pc.printf("%lf %lf\r\n", 0, 0); //gps.latitude=0, gps.longitude=0 next_x = 30; next_y = 30; theta = atan(next_x - 0 / next_y - 0) * 180 / M_PI; printf("%f", theta); delta = theta - angle; printf("%f-%f=%f\r\n", theta, angle, delta); //} /* else { pc.printf("No data\r\n");//データ取得に失敗した場合 wait(1); } */ wait(2); } }