航空研究会 / Mbed 2 deprecated HMC5883L_kai_4

Dependencies:   mbed HMC5883L_kai_3

Files at this revision

API Documentation at this revision

Comitter:
imanomadao
Date:
Mon Feb 24 07:47:52 2020 +0000
Parent:
2:2ce6c35efc65
Commit message:
a;

Changed in this revision

HMC5883L.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/HMC5883L.lib	Fri Nov 15 12:21:29 2019 +0000
+++ b/HMC5883L.lib	Mon Feb 24 07:47:52 2020 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/teams/1519026547/code/HMC5883L_lib/#38050f18f60a
+https://os.mbed.com/teams/1519026547/code/HMC5883L_kai_3/#8b6e984df00b
--- a/main.cpp	Fri Nov 15 12:21:29 2019 +0000
+++ b/main.cpp	Mon Feb 24 07:47:52 2020 +0000
@@ -3,24 +3,31 @@
 
 HMC5883L compass(PB_9, PB_8); 
 
+RawSerial pc(USBTX, USBRX, 9600);
+
 int main(){ 
    int16_t a[3];
    double b;
   
-   while(1){
+   /*while(1){
        compass.init();
        b= compass.getHeadingXYDeg(-152,286);
        printf("%lf\r\n",b);
-       
+       wait(1);
       // wait(0.);
-       }
+       }*/
        
-   /*while(1){
-   compass.getXYZ(a);
-   //printf("%d, %d, %d,\r\n",a[0],a[2]-150,a[1]);
-   printf("%d, %d\r\n",a[0]+20,a[2]+50);
-   //wait(1);}
+    compass.init();
+    wait_ms(10);
+   while(1){
+        compass.getXYZ(a);
+        pc.printf("x=%d, y=%d, z=%d,\r\n",a[0],a[2],a[1]);
+        b= compass.getHeadingXYDeg(-152,286);
+        pc.printf("%lf\r\n",b);
+        //printf("%d, %d\r\n",a[0]+20,a[2]+50);
+        wait(1);
+   }
 
   
-    }*/
+    //}
 }