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.
Diff: main.cpp
- Revision:
- 0:83aeb4287ca7
- Child:
- 1:e24f8a7fc545
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Fri Jun 17 15:14:59 2016 +0000
@@ -0,0 +1,28 @@
+#include "mbed.h"
+#include "MPU6050.h"
+#define acc 16384
+#define gyro 131
+
+DigitalOut myled(LED1);
+MPU6050 mpu(D4,D5);
+Serial pc(USBTX, USBRX);
+
+int main() {
+ float a[3];
+ float g[3];
+ mpu.setAcceleroRange(0);
+ mpu.setGyroRange(0);
+ while(1) {
+ myled = 1;
+ wait(0.2);
+ myled = 0;
+ wait(0.2);
+ a[0] = (float)mpu.getAcceleroRawX()/acc;
+ a[1] = (float)mpu.getAcceleroRawY()/acc;
+ a[2] = (float)mpu.getAcceleroRawZ()/acc;
+ g[0] = (float)mpu.getGyroRawX()/gyro;
+ g[1] = (float)mpu.getGyroRawY()/gyro;
+ g[2] = (float)mpu.getGyroRawZ()/gyro;
+ pc.printf("%f,%f,%f,%f,%f,%f\n",a[0],a[1],a[2],g[0],g[1],g[2]);
+ }
+}