Timothy Daw
/
main2
mpu6050
main.cpp
- Committer:
- TimothyDaw
- Date:
- 2020-02-28
- Revision:
- 0:68bfb6ebd7a1
File content as of revision 0:68bfb6ebd7a1:
//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(SERIAL_TX, SERIAL_RX); //setting LED1 to give digital output DigitalOut myled(LED1); //creating onject of MPU6050 class MPU6050 ark(PB_9,PB_8); int main() { pc.printf("test"); 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); pc.printf("MPU0\n\r%f, \t%f, \t%f,",gyro[0],gyro[1],gyro[2]); //reading Acclerometer readings float acce[3]; ark.getAccelero(acce); pc.printf(" %f, %f, %f\r\n************\n\r",acce[0],acce[1],acce[2]); //reading Grometer readings float gyro1[3]; ark.getGyro(gyro); pc.printf("MPU1\n\r%f, \t%f, \t%f,",gyro[0],gyro[1],gyro[2]); //reading Acclerometer readings float acce1[3]; ark.getAccelero(acce); pc.printf(" %f, %f, %f\r\n*****6969********\n\r",acce[0],acce[1],acce[2]); wait(0.1); //wait } }