Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 0:84dda456d02c, committed 2013-01-11
- Comitter:
- garfieldsg
- Date:
- Fri Jan 11 00:58:23 2013 +0000
- Commit message:
- test of mpu6050
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MPU6050.lib Fri Jan 11 00:58:23 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/garfieldsg/code/MPU6050/#662207e34fba
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Fri Jan 11 00:58:23 2013 +0000
@@ -0,0 +1,32 @@
+#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.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("%d;%d;%d;%d;%d;%d\n",ax,ay,az,gx,gy,gz);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Jan 11 00:58:23 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/71b101360fb9 \ No newline at end of file