SSSUP
/
sample_MPU6050
MPU6050サンプルプログラム
Fork of MPU6050_test by
main.cpp@2:fc47fabf9268, 2018-07-07 (annotated)
- Committer:
- masafumiyamada
- Date:
- Sat Jul 07 07:59:46 2018 +0000
- Revision:
- 2:fc47fabf9268
- Parent:
- 0:5ac6fdeb615e
???????_MPU6050
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
beingblock | 0:5ac6fdeb615e | 1 | #include "mbed.h" |
beingblock | 0:5ac6fdeb615e | 2 | #include "MPU6050.h" |
beingblock | 0:5ac6fdeb615e | 3 | |
beingblock | 0:5ac6fdeb615e | 4 | DigitalOut myled(LED1); |
masafumiyamada | 2:fc47fabf9268 | 5 | MPU6050 mpu(p9,p10); |
beingblock | 0:5ac6fdeb615e | 6 | |
beingblock | 0:5ac6fdeb615e | 7 | int main() { |
beingblock | 0:5ac6fdeb615e | 8 | while(1){ |
beingblock | 0:5ac6fdeb615e | 9 | int gyro[3]; |
beingblock | 0:5ac6fdeb615e | 10 | mpu.readGyroData(gyro); //gyro[3]に代入 |
beingblock | 0:5ac6fdeb615e | 11 | printf("x:%d y:%d z:%d\r\n",gyro[0],gyro[1],gyro[2]); |
beingblock | 0:5ac6fdeb615e | 12 | wait(0.1); |
beingblock | 0:5ac6fdeb615e | 13 | } |
beingblock | 0:5ac6fdeb615e | 14 | |
beingblock | 0:5ac6fdeb615e | 15 | /* おまけ 加速度 |
beingblock | 0:5ac6fdeb615e | 16 | while(1){ |
beingblock | 0:5ac6fdeb615e | 17 | int accel[3]; |
beingblock | 0:5ac6fdeb615e | 18 | mpu.readAccelData(acc); |
beingblock | 0:5ac6fdeb615e | 19 | printf("x:%d y:%d z:%d\r\n",accel[0],accel[1],accel[2]); |
beingblock | 0:5ac6fdeb615e | 20 | } |
beingblock | 0:5ac6fdeb615e | 21 | */ |
beingblock | 0:5ac6fdeb615e | 22 | |
beingblock | 0:5ac6fdeb615e | 23 | } |