ok

Dependencies:   MPU6050 mbed

main.cpp

Committer:
fadi_lad
Date:
2017-02-17
Revision:
0:d61dfa687ac8
Child:
2:500e1c72e56b

File content as of revision 0:d61dfa687ac8:

//include libraries in cpp file
#include "mbed.h"
#include "MPU6050.h"

//creating an object of serial class
//so that we can communicate with PC
Serial pc(D8, NC);

//setting LED1 to give digital output
DigitalOut myled(LED1);

//creating onject of MPU6050 class
MPU6050 ark(PB_9,PB_8);

int main()
{
    pc.baud (256000);
    
    while(1) {
        //reading Temprature
        /*float temp = ark.getTemp();
        pc.printf("temprature = %0.2f ^C\r\n",temp); */   
        //reading Grometer readings
        float gyro[3];
        ark.getGyro(gyro);
        
        //reading Acclerometer readings
        float acce[3];
        ark.getAccelero(acce);
        
        pc.printf("U %f %f %f %f %f %f %f %f %f /",acce[0],acce[1],acce[2],gyro[0],gyro[1],gyro[2],acce[0],acce[1],acce[2]);

        wait(0.01); //wait 1000ms
    }
}