Nucleo F303K8とMPU6050を用いた1軸加速度検出における処理時間の計測

Dependencies:   MPU6050 mbed

Files at this revision

API Documentation at this revision

Comitter:
RyotaNakamura
Date:
Fri Feb 10 01:15:28 2017 +0000
Commit message:
1?????????

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 703868f31291 MPU6050.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MPU6050.lib	Fri Feb 10 01:15:28 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Sissors/code/MPU6050/#5c63e20c50f3
diff -r 000000000000 -r 703868f31291 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Feb 10 01:15:28 2017 +0000
@@ -0,0 +1,32 @@
+#include "mbed.h"
+
+#include "MPU6050.h"
+#define acc 16384
+
+DigitalOut myled(LED1);
+MPU6050 mpu(D4,D5);
+Serial pc(USBTX, USBRX);
+Timer timer;
+
+int main(){
+    float a[3];
+    int miri=1000;
+    mpu.setAcceleroRange(0);
+    
+    while(1) {
+        wait(1);
+        
+        myled = 1;
+        wait(0.2);
+        myled = 0;
+        wait(0.2);
+
+        timer.reset();
+        timer.start();
+        a[0] = (float)mpu.getAcceleroRawX()/acc;
+        timer.stop();
+        float t=timer.read();
+        float time=t*miri;
+        pc.printf("time= %f ms\n",time);
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r 703868f31291 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Feb 10 01:15:28 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/176b8275d35d
\ No newline at end of file