MPU9250 library using dmp, it uses sparkfun arduino library and invensense Motion driver 6.1.
Dependencies: MotionDriver_6_1 SparkFunMPU9250-DMP mbed
Diff: main.cpp
- Revision:
- 7:a862072e0981
- Parent:
- 6:981cb17c7ea3
- Child:
- 8:b9206956f396
--- a/main.cpp Mon Aug 14 07:11:49 2017 +0000 +++ b/main.cpp Mon Aug 14 07:37:15 2017 +0000 @@ -4,6 +4,7 @@ Serial pc(SERIAL_TX,SERIAL_RX); DigitalOut led(LED1); MPU9250_DMP imu; +//variables unsigned char whoami[1]={0}; unsigned char fifo_count[2]={32,32}; unsigned char temp[1]={32}; @@ -12,6 +13,8 @@ unsigned char regadd; char registeradress[5]; unsigned char registerdata[]={33}; +unsigned long count=0; +//Prototypes void printIMUData(void); int main() { @@ -38,6 +41,7 @@ else{ pc.printf("imu.dmpBegin() suceeded\n"); } + pc.printf("$GETEU,*\n");//indicationg that data will send to matlab by serial #endif #if 0//this scope is only for debugging purposes of mbed_i2c_read and write functions mbed_i2c_read(0x68,0x75,1,whoami); @@ -68,10 +72,6 @@ }*/ // Check for new data in the FIFO if (imu.fifoAvailable()){//fifo is not being available - led=0; - wait_ms(50); - led=1; - wait_ms(50); // Use dmpUpdateFifo to update the ax, gx, mx, etc. values if ( imu.dmpUpdateFifo() == INV_SUCCESS){ // computeEulerAngles can be used -- after updating the @@ -101,5 +101,5 @@ float q2 = imu.calcQuat(imu.qy); float q3 = imu.calcQuat(imu.qz); - pc.printf("Y:%lf P:%lf R:%lf \n", imu.yaw,imu.pitch,imu.roll); + pc.printf("t:%d\t Y:%lf\t P:%lf\t R:%lf\n",get_ms(&count), imu.yaw,imu.pitch,imu.roll); }