For Hepta-Sat Lite

Revision:
4:01941772f493
Parent:
3:d5eed0bb962e
Child:
5:098423fb0371
diff -r d5eed0bb962e -r 01941772f493 Hepta9axis.cpp
--- a/Hepta9axis.cpp	Mon Sep 04 11:45:42 2017 +0000
+++ b/Hepta9axis.cpp	Mon Sep 04 16:27:17 2017 +0000
@@ -88,7 +88,7 @@
     n_axis.stop();
 
     double  acc_az = short((zh<<8) | (zl));
-    *az = (acc_az)*2/32764*9.81-0.1;
+    *az = (acc_az)*2/32764*9.81;
 
 }
 
@@ -112,7 +112,7 @@
     n_axis.stop();
 
     double  gyro_ax = short((gxh<<8) | (gxl));
-    *gx = (gyro_ax)*0.00763-1.6;
+    *gx = (gyro_ax)*0.00763;
 
 //y軸GYRO
     n_axis.start();
@@ -179,100 +179,9 @@
     n_axis.write(addr_compus|0x01);
     mxh = n_axis.read(0);
     n_axis.stop();
-    /*
-     n_axis.start();
-     n_axis.write(addr_compus);
-    n_axis.write(0x09);
-    n_axis.write(addr_compus|0x01);
-    n_axis.stop();
-    */
+    
     double  mg_x = short((mxh<<8) | (mxl));
     *mx = ( mg_x)*0.15;
-    //pc.printf("MGX = %f\t",mx);
-
-    n_axis.start();
-
-    n_axis.write(addr_compus);
-    n_axis.write(0x05);
-    n_axis.start();
-    n_axis.write(addr_compus|0x01);
-    myl = n_axis.read(0);
-    n_axis.stop();
-    n_axis.start();
-    n_axis.write(addr_compus);
-    n_axis.write(0x06);
-    n_axis.start();
-    n_axis.write(addr_compus|0x01);
-    myh = n_axis.read(0);
-    n_axis.stop();
-    /*
-         n_axis.start();
-         n_axis.write(addr_compus);
-        n_axis.write(0x09);
-        n_axis.write(addr_compus|0x01);
-        n_axis.stop();
-        */
-    double  mg_y = short((myh<<8) | (myl));
-    *my = ( mg_y)*0.15;
-    // pc.printf("MAGY = %f\t",my);
-
-    n_axis.start();
-
-    n_axis.write(addr_compus);
-    n_axis.write(0x07);
-    n_axis.start();
-    n_axis.write(addr_compus|0x01);
-    mzl = n_axis.read(0);
-    n_axis.stop();
-    n_axis.start();
-    n_axis.write(addr_compus);
-    n_axis.write(0x08);
-    n_axis.start();
-    n_axis.write(addr_compus|0x01);
-    mzh = n_axis.read(0);
-    n_axis.stop();
-
-    n_axis.start();
-    n_axis.write(addr_compus);
-    n_axis.write(0x09);
-    n_axis.start();
-    n_axis.write(addr_compus|0x01);
-    n_axis.stop();
-    double  mg_z= short((mzh<<8) | (mzl));
-    *mz = ( mg_z)*0.15;
-    /*
-    n_axis.start();
-    n_axis.write(addr_compus);
-    n_axis.write(0x0a);
-    n_axis.write(0x12);
-    n_axis.stop();
-
-    n_axis.start();
-    n_axis.write(addr_compus);
-    n_axis.write(0x03);
-    n_axis.start();
-    n_axis.write(addr_compus|0x01);
-    mxl = n_axis.read(0);
-    n_axis.stop();
-    n_axis.start();
-    n_axis.write(addr_compus);
-    n_axis.write(0x04);
-    n_axis.start();
-    n_axis.write(addr_compus|0x01);
-    mxh = n_axis.read(0);
-    n_axis.stop();
-
-    n_axis.start();
-    n_axis.write(addr_compus);
-    n_axis.write(0x09);
-    n_axis.start();
-    n_axis.write(addr_compus|0x01);
-    n_axis.stop();
-
-
-    double  mg_x = short((mxh<<8) | (mxl));
-    *mx = ( mg_x)*0.15;
-
 
     n_axis.start();
 
@@ -290,12 +199,6 @@
     myh = n_axis.read(0);
     n_axis.stop();
 
-    n_axis.start();
-    n_axis.write(addr_compus);
-    n_axis.write(0x09);
-    n_axis.start();
-    n_axis.write(addr_compus|0x01);
-    n_axis.stop();
     double  mg_y = short((myh<<8) | (myl));
     *my = ( mg_y)*0.15;
 
@@ -320,11 +223,11 @@
     n_axis.write(0x09);
     n_axis.start();
     n_axis.write(addr_compus|0x01);
+    st2 = n_axis.read(0);
     n_axis.stop();
-
     double  mg_z= short((mzh<<8) | (mzl));
-    *mz = ( mg_z)*0.15;*/
-    //pc.printf("MAGZ = %f\r\n",mz);
+    *mz = ( mg_z)*0.15;
+   
 }
 
 //////////////16進数表記/////////////////////////////////////////
@@ -508,8 +411,6 @@
     mx_u16[2]=m2[0];
     mx_u16[3]=m2[1];
 
-    //pc.printf("MGX = %f\t",mx);
-
     n_axis.start();
 
     n_axis.write(addr_compus);
@@ -532,7 +433,6 @@
     my_u16[1]=m1[1];
     my_u16[2]=m2[0];
     my_u16[3]=m2[1];
-    // pc.printf("MAGY = %f\t",my);
 
     n_axis.start();
 
@@ -555,6 +455,7 @@
     n_axis.write(0x09);
     n_axis.start();
     n_axis.write(addr_compus|0x01);
+    st2 = n_axis.read(0);
     n_axis.stop();
 
     sprintf( m1, "%02X", ((mzh)) & 0xFF);