Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed MPU6050 Math
Fork of MPU6050_cansat by
Revision 7:8f914ead7fc0, committed 2018-11-24
- Comitter:
- falconsyunya
- Date:
- Sat Nov 24 00:01:13 2018 +0000
- Parent:
- 6:f1106d9e843c
- Commit message:
- 2018/11/24 9:01
Changed in this revision
| MPU6050.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/MPU6050.lib Tue Nov 20 13:51:57 2018 +0000 +++ b/MPU6050.lib Sat Nov 24 00:01:13 2018 +0000 @@ -1,1 +1,1 @@ -https://os.mbed.com/teams/cansat-d_2018/code/MPU6050/#118c17d86087 +https://os.mbed.com/teams/cansat-d_2018/code/MPU6050/#51bd76211e3b
--- a/main.cpp Tue Nov 20 13:51:57 2018 +0000
+++ b/main.cpp Sat Nov 24 00:01:13 2018 +0000
@@ -16,11 +16,13 @@
int accel[3];//accelを3つの配列で定義。
while(1){
mpu.readAccelData(accel);//加速度の値をaccel[3]に代入
- int x = accel[0];//x軸方向の加速度
- int y = accel[1];//y軸方向の加速度
- int z = accel[2];//z軸方向の加速度
- float a = x^2+y^2+z^2;
- printf("%f\r\n",a);
+ int x = accel[0]-123;//x軸方向の加速度
+ int y = accel[1]+60;//y軸方向の加速度
+ int z = accel[2]+1110 ;//z軸方向の加速度
+ float X = x*0.000597964111328125;
+ float Y = y*0.000597964111328125;
+ float Z = z*0.000597964111328125;
+ double a = X*X+Y*Y+Z*Z-95.982071137936;
if (a>0){
a = sqrt(a);
}
@@ -28,6 +30,7 @@
a = abs(a);
a = -sqrt(a);
}
+ //printf("%lf %f %f %f\r\n",a,X,Y,Z);
// ローパスフィルター(現在の値 = 係数 * ひとつ前の値 + (1 - 係数) * センサの値)
lowpassValue = lowpassValue * filterCoefficient + a * (1 - filterCoefficient);
// ハイパスフィルター(センサの値 - ローパスフィルターの値)//
@@ -43,7 +46,7 @@
//printf(" speed %f difference %f\r\n",speed,difference);//速度と加速度を表示
//printf("%f,",speed);//速度を表示
- //printf("speed %f diference %f\r\n",speed,difference);//変位を表示
- wait(0.5);
+ printf("speed %f diference %f\r\n",speed,difference);//速度と変位を表示
+ wait(0.01);
}
}
