mpu6050

Dependencies:   MPU6050 mbed

Files at this revision

API Documentation at this revision

Comitter:
oakx
Date:
Wed Jul 02 16:19:28 2014 +0000
Commit message:
hello

Changed in this revision

MPU6050.lib 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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r db87af04ff89 MPU6050.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MPU6050.lib	Wed Jul 02 16:19:28 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/garfieldsg/code/MPU6050/#1e0baaf91e96
diff -r 000000000000 -r db87af04ff89 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Jul 02 16:19:28 2014 +0000
@@ -0,0 +1,34 @@
+#include "mbed.h"
+#include "MPU6050.h"
+ 
+DigitalOut myled(LED1);
+Serial pc(USBTX, USBRX);
+MPU6050 mpu;
+ 
+int16_t ax, ay, az;
+int16_t gx, gy, gz;
+ 
+int main()
+{
+    pc.baud(9600);
+    pc.printf("MPU6050 test\n\n");
+    pc.printf("MPU6050 initialize \n");
+ 
+    mpu.initialize();
+    pc.printf("MPU6050 testConnection \n");
+ 
+      bool mpu6050TestResult = mpu.testConnection();
+    if(mpu6050TestResult) {
+        pc.printf("MPU6050 test passed \n");
+    } else {
+        pc.printf("MPU6050 test failed \n");
+    }
+   
+    while(1) {
+        wait(1);
+        mpu.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
+        //writing current accelerometer and gyro position 
+        pc.printf("ax = %d ,ay = %d ,az = %d , gx = %d, gy = %d, gz = %d\n",ax,ay,az,gx,gy,gz);
+    }
+    
+}
\ No newline at end of file
diff -r 000000000000 -r db87af04ff89 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Jul 02 16:19:28 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/04dd9b1680ae
\ No newline at end of file