completed code

Dependencies:   mbed

main.cpp

Committer:
tlee6414
Date:
2018-11-15
Revision:
2:a4d5e7f96e87
Parent:
0:f43994f44684
Child:
3:461a9012682d

File content as of revision 2:a4d5e7f96e87:

#include "sensor_fusion.h"

MPU6050 mpu(SDA,SCL);

int main() {
    mpu.start();
    
    while(1) {
        if (!mpu.data_ready()) {
            continue;
        }
        
        float accel_x, accel_y, accel_z, gyro_x, gyro_y, gyro_z;
        mpu.read_raw(&gyro_x, &gyro_y, &gyro_z, &accel_x, &accel_y, &accel_z);
        
        printf("ax:%f\n ay: %f\n az: %f\n gx: %f\n gy: %f\n gz: %f\r\n", accel_x, accel_y, accel_z, gyro_x, gyro_y, gyro_z);
        printf("____________________\n");
        wait(1);
    }
}