![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
加速度センサMPU6050 サンプルプログラムでは、xyz軸の加速度を表示します。
Dependencies: mbed MPU6050 Math
Fork of MPU6050_cansat by
main.cpp@0:4ba3fa671062, 2018-10-19 (annotated)
- Committer:
- falconsyunya
- Date:
- Fri Oct 19 15:03:37 2018 +0000
- Revision:
- 0:4ba3fa671062
- Child:
- 1:958b581f6d21
??????
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
falconsyunya | 0:4ba3fa671062 | 1 | #include "mbed.h" |
falconsyunya | 0:4ba3fa671062 | 2 | #include "MPU6050.h" |
falconsyunya | 0:4ba3fa671062 | 3 | |
falconsyunya | 0:4ba3fa671062 | 4 | DigitalOut myled(LED1); |
falconsyunya | 0:4ba3fa671062 | 5 | MPU6050 mpu(p9,p10);//(SDA,SCL) |
falconsyunya | 0:4ba3fa671062 | 6 | |
falconsyunya | 0:4ba3fa671062 | 7 | int main() { |
falconsyunya | 0:4ba3fa671062 | 8 | while(1){ |
falconsyunya | 0:4ba3fa671062 | 9 | int accel[3];//accel配列 |
falconsyunya | 0:4ba3fa671062 | 10 | mpu.readAccelData(accel);//accel[3]に代入 |
falconsyunya | 0:4ba3fa671062 | 11 | printf("accel x:%d y:%d z:%d\r\n %d",accel[0],accel[1],accel[2],x); |
falconsyunya | 0:4ba3fa671062 | 12 | wait(0.05); |
falconsyunya | 0:4ba3fa671062 | 13 | } |
falconsyunya | 0:4ba3fa671062 | 14 | } |