MPU6050サンプルプログラム

Dependencies:   MPU-6050 mbed

Fork of MPU6050_test by SSSRC 2016s

main.cpp

Committer:
beingblock
Date:
2016-05-24
Revision:
0:5ac6fdeb615e
Child:
2:fc47fabf9268

File content as of revision 0:5ac6fdeb615e:

#include "mbed.h"
#include "MPU6050.h"

DigitalOut myled(LED1);
MPU6050 mpu(PB_9,PB_8);

int main() {
    while(1){
        int gyro[3];
        mpu.readGyroData(gyro); //gyro[3]に代入
        printf("x:%d y:%d z:%d\r\n",gyro[0],gyro[1],gyro[2]);
        wait(0.1);
    }
    
    /* おまけ 加速度
    while(1){
        int accel[3];
        mpu.readAccelData(acc);
        printf("x:%d y:%d z:%d\r\n",accel[0],accel[1],accel[2]);
    }
    */
    
}