demo of the optimized MPU6050 library

Dependencies:   MPU6050-DMP mbed

Fork of MPU6050-DMP_test by Match Lab

Revision:
3:0fd6f597d8dd
Parent:
2:7ef42101b204
--- a/main.cpp	Sun Feb 22 03:09:44 2015 +0000
+++ b/main.cpp	Thu Feb 26 04:02:36 2015 +0000
@@ -31,8 +31,8 @@
 
 
 RawSerial pc(USBTX, USBRX);
-MPU6050 mpu(dp5, dp27);     // sda, scl pin
-InterruptIn INT0(dp13);     // INT0 pin
+MPU6050 mpu(P0_20, P0_22);     // sda, scl pin
+InterruptIn INT0(P0_21);     // INT0 pin
 
 const int FIFO_BUFFER_SIZE = 128;
 uint8_t fifoBuffer[FIFO_BUFFER_SIZE];
@@ -74,7 +74,15 @@
     INT0.mode(PullDown);
     INT0.fall(dmpDataUpdate);
     
-    mpu.initialize();
+    //mpu.initialize();
+    
+    mpu.setClockSource(MPU6050_CLOCK_PLL_ZGYRO);
+    mpu.setFullScaleGyroRange(MPU6050_GYRO_FS_2000);
+    mpu.setFullScaleAccelRange(MPU6050_ACCEL_FS_2);
+    mpu.setDLPFMode(MPU6050_DLPF_BW_20);  //10,20,42,98,188
+    mpu.setRate(4);   // 0=1khz 1=500hz, 2=333hz, 3=250hz 4=200hz
+    mpu.setSleepEnabled(false);
+    
     if (mpu.testConnection()) {
         pc.puts("MPU6050 test connection passed.\n");
     } else {