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
Revision 1:958b581f6d21, committed 2018-10-19
- Comitter:
- falconsyunya
- Date:
- Fri Oct 19 16:04:40 2018 +0000
- Parent:
- 0:4ba3fa671062
- Child:
- 2:84a9df66cecd
- Commit message:
- ??????; ????????????G???
Changed in this revision
| MPU-6050.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/MPU-6050.lib Fri Oct 19 15:03:37 2018 +0000 +++ b/MPU-6050.lib Fri Oct 19 16:04:40 2018 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/teams/SSSRC-2016s/code/MPU-6050/#1c676c1200d8 +https://os.mbed.com/teams/cansat-d_2018/code/MPU-6050/#320b2c273b27
--- a/main.cpp Fri Oct 19 15:03:37 2018 +0000
+++ b/main.cpp Fri Oct 19 16:04:40 2018 +0000
@@ -1,14 +1,19 @@
#include "mbed.h"
#include "MPU6050.h"
+//うp遅れてすいません。基本Flaoatで定義してクレメンス。
+
DigitalOut myled(LED1);
-MPU6050 mpu(p9,p10);//(SDA,SCL)
+MPU6050 mpu(p9,p10);//(SDA,SCL)のピンをアサインしてね☆
int main() {
while(1){
- int accel[3];//accel配列
- mpu.readAccelData(accel);//accel[3]に代入
- printf("accel x:%d y:%d z:%d\r\n %d",accel[0],accel[1],accel[2],x);
+ float accel[3];//accelを3つの配列で定義。
+ mpu.readAccelData(accel);//加速度の値をaccel[3]に代入
+ float x = accel[0]/16384;//x軸方向の加速度
+ float y = accel[1]/16384;//y軸方向の加速度
+ float z = accel[2]/16384;//z軸方向の加速度
+ printf("accel x:%f y:%f z:%f\r\n",x,y,z);//一応表示しとくやで~~
wait(0.05);
}
}