x

Dependencies:   MPU6050 mbed

Files at this revision

API Documentation at this revision

Comitter:
rm_9x
Date:
Tue Nov 21 15:55:27 2017 +0000
Commit message:
x

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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MPU6050.lib	Tue Nov 21 15:55:27 2017 +0000
@@ -0,0 +1,1 @@
+http://os.mbed.com/users/Sissors/code/MPU6050/#5c63e20c50f3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Nov 21 15:55:27 2017 +0000
@@ -0,0 +1,28 @@
+#include "mbed.h"
+#include "MPU6050.h"
+ 
+Serial pc(USBTX, USBRX); // tx, rx
+MPU6050 mpu(p9, p10);   //Also disables sleep mode
+ 
+int main() {
+    int accdata[3];
+    int gyrodata[3];
+    
+    wait(0.1);
+    if (mpu.testConnection())
+        pc.printf("MPU connection succeeded\n\r");
+    else
+        pc.printf("MPU connection failed\n\r");
+        
+    while(1) {
+        mpu.getAcceleroRaw(accdata);
+        mpu.getGyroRaw(gyrodata);
+        
+        pc.printf("Accelero data: X: %d - Y: %d - Z: %d\n\r", accdata[0], accdata[1], accdata[2]);
+        pc.printf("Gyro data: X: %d - Y: %d - Z: %d\n\r\n\r", gyrodata[0], gyrodata[1], gyrodata[2]);
+        
+        wait(1);
+    }
+        
+        
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Nov 21 15:55:27 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/e7ca05fa8600
\ No newline at end of file