加速度センサのプログラムです(zの政府で判断、PCに表示)
Dependencies: mbed
Revision 1:8d3dd0d73048, committed 2019-11-19
- Comitter:
- Nryo
- Date:
- Tue Nov 19 06:01:35 2019 +0000
- Parent:
- 0:d8462d09ff84
- Commit message:
- MPU6050
Changed in this revision
mpu6050.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r d8462d09ff84 -r 8d3dd0d73048 mpu6050.cpp --- a/mpu6050.cpp Sat Nov 16 06:31:31 2019 +0000 +++ b/mpu6050.cpp Tue Nov 19 06:01:35 2019 +0000 @@ -1,17 +1,17 @@ #include "mbed.h" -#include "MPU6050.h" +#include "mpu6050.h" -DigitalOut myled(LED1); + MPU6050 mpu(p9,p10); int main() { - int acc[3];//accを定義。 + int accel[3];//accを定義。 while(1){ mpu.readAccelData(accel);//加速度の値をacc[3]に代入 - int x = acc[0];//x軸方向の加速度 - int y = acc[1];//y軸方向の加速度 - int z = acc[2];//z軸方向の加速度 + int x = accel[0];//x軸方向の加速度 + int y = accel[1];//y軸方向の加速度 + int z = accel[2];//z軸方向の加速度 printf("x:%06d y:%06d z:%06d\r\n",x,y,z); wait(0.01);