Esdras Nicolás Rodríguez Lantigua
/
MPU6050Test
Sofia Wheelchair MPU6050
main.cpp
- Committer:
- erodrz
- Date:
- 2021-07-16
- Revision:
- 0:183a252cfa2a
File content as of revision 0:183a252cfa2a:
//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); //creating object of MPU6050 class MPU6050 ark(PB_9,PB_8); int main() { while(1) { //reading Grometer readings float gyro[3]; ark.getGyro(gyro); pc.printf("Gyro X = %f\r\n",gyro[0]); pc.printf("Gyro Y = %f\r\n",gyro[1]); pc.printf("Gyro Z = %f\r\n",gyro[2]); pc.printf("\r\n"); //reading Acclerometer readings float acce[3]; ark.getAccelero(acce); pc.printf("Acce X = %f\r\n",acce[0]); pc.printf("Acce Y = %f\r\n",acce[1]); pc.printf("Acce Z = %f\r\n",acce[2]); pc.printf("\r\n"); wait(1); //wait 1000ms } }