demo of the optimized MPU6050 library

Dependencies:   MPU6050-DMP mbed

Fork of MPU6050-DMP_test by Match Lab

Files at this revision

API Documentation at this revision

Comitter:
zcw607
Date:
Thu Feb 26 04:02:36 2015 +0000
Parent:
2:7ef42101b204
Commit message:
test modified library

Changed in this revision

MPU6050-DMP-Ian.lib Show annotated file Show diff for this revision Revisions of this file
config.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 7ef42101b204 -r 0fd6f597d8dd MPU6050-DMP-Ian.lib
--- a/MPU6050-DMP-Ian.lib	Sun Feb 22 03:09:44 2015 +0000
+++ b/MPU6050-DMP-Ian.lib	Thu Feb 26 04:02:36 2015 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/users/pHysiX/code/MPU6050-DMP-Ian/#86afc8447df9
+http://developer.mbed.org/users/zcw607/code/MPU6050-DMP/#4d3c598e3719
diff -r 7ef42101b204 -r 0fd6f597d8dd config.h
--- a/config.h	Sun Feb 22 03:09:44 2015 +0000
+++ b/config.h	Thu Feb 26 04:02:36 2015 +0000
@@ -15,4 +15,4 @@
 // But other value doesn't yet support.
 #define MPU6050_ACCEL_FS MPU6050_ACCEL_FS_2
 
-#define PC_BAUDRATE 921600
\ No newline at end of file
+#define PC_BAUDRATE 115200
\ No newline at end of file
diff -r 7ef42101b204 -r 0fd6f597d8dd main.cpp
--- 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 {