MPU6050のサンプルプログラム2

Dependencies:   ConfigFile SDFileSystem mbed

Fork of LAURUS_program by LAURUS

Revision:
1:6cd6d2760856
Parent:
0:bc6f14fc60c7
--- a/HMC5883L/HMC5883L.cpp	Fri May 15 17:24:32 2015 +0000
+++ b/HMC5883L/HMC5883L.cpp	Sun May 24 17:32:47 2015 +0000
@@ -1,9 +1,7 @@
 #include "mbed.h"
 #include "HMC5883L.h"
 
-HMC5883L::HMC5883L(I2C* i2c) {
-    this->i2c = i2c;
-}
+HMC5883L::HMC5883L(I2C* p_i2c): i2c(p_i2c) {}
 
 HMC5883L::~HMC5883L() {
     i2c = NULL;
@@ -30,9 +28,15 @@
         data.reg[i*2+1] = temp;
     }
     
+    // 軸を加速度センサーとあわせる
     int16_t temp = data.value[1];
     data.value[1] = data.value[2];
     data.value[2] = temp;
     
+    temp = data.value[1];
+    data.value[1] = -data.value[0];
+    data.value[0] = temp;
+    
+    
     return 1;
 }
\ No newline at end of file