マイナスの値が出ないように修正
Dependencies: mbed HMC5883L_2
Diff: main.cpp
- Revision:
- 0:26409a44f1f3
- Child:
- 1:c91577293e84
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Feb 06 11:54:51 2019 +0000 @@ -0,0 +1,24 @@ +#include "mbed.h" +#include "HMC5883L.h" + +HMC5883L compass(PB_9, PB_8); + +int main(){ + int16_t a[3]; + double b; + + while(1){ + compass.init(); + b= compass.getHeadingXYDeg(0,-150); + printf("%lf\r\n",b); + wait(1); + } + + /*while(1){ + compass.getXYZ(a); + printf("%d, %d, %d,\r\n",a[0],a[2]-150,a[1]); + wait(1);} +*/ + + } +