Bluepill version of mpu9250-dmp library of sparkfun
Dependencies: MotionDriver_6_1 SparkFunMPU9250-DMP mbed-STM32F103C8T6 mbed
Fork of MPU9250-dmp by
Diff: main.cpp
- Revision:
- 3:740f15b45cb8
- Parent:
- 2:7be1ac6eb8cb
- Child:
- 4:9d706f783b5a
--- a/main.cpp Tue Aug 08 08:39:57 2017 +0000 +++ b/main.cpp Tue Aug 08 14:15:53 2017 +0000 @@ -21,14 +21,14 @@ Serial pc(USBTX,USBRX); DigitalOut led(LED1); MPU9250_DMP imu; -char datax[1]={0}; +char whoami[1]={0}; long DEBUG[]={2,2,2,2}; int main() { pc.baud(115200); pc.printf("Hello World\n"); // Call imu.begin() to verify communication and initialize - pc.printf("imu.begin()is being run\n"); + pc.printf("imu.begin() is being run\n"); if (imu.begin() != INV_SUCCESS){ pc.printf("imu.begin() have failed"); while (1){ @@ -45,26 +45,27 @@ // accelerometer in low-power mode to estimate quat's. // DMP_FEATURE_LP_QUAT and 6X_LP_QUAT are mutually exclusive pc.printf("imu.dmpBegin() suceeded\n"); - + mbed_i2c_read(0x68,0x75,1,whoami); + pc.printf("%d\n",whoami[0]); while(1){ // Check for new data in the FIFO led=1; wait_ms(500); led=0; wait_ms(500); - mbed_i2c_read((unsigned char)0x68,(unsigned char)0x75,1,datax); - pc.printf("%d",datax[0]); - if ( imu.fifoAvailable() ){//fifo is not being available + if (imu.fifoAvailable()){//fifo is not being available led=0; wait_ms(100); led=1; wait_ms(100); + pc.printf("fifo sucesfully available\n"); // Use dmpUpdateFifo to update the ax, gx, mx, etc. values if ( imu.dmpUpdateFifo(DEBUG) == INV_SUCCESS){ // computeEulerAngles can be used -- after updating the // quaternion values -- to estimate roll, pitch, and yaw imu.computeEulerAngles(); //printIMUData(); + pc.printf("dmpUpdateFifo sucesfully occured\n"); #if 1 pc.printf("%lf",DEBUG[0]); pc.printf("\t");