Nucleo F303K8とMPU6050を用いた1軸ジャイロ検出における処理時間の計測
Fork of Time_MPU6050_Gyro1 by
main.cpp
- Committer:
- RyotaNakamura
- Date:
- 2017-02-06
- Revision:
- 0:ac9f75330f86
File content as of revision 0:ac9f75330f86:
#include "mbed.h" #include "MPU6050.h" #define gyro 131 DigitalOut myled(LED1); MPU6050 mpu(D4,D5); Serial pc(USBTX, USBRX); Timer timer; int main() { float g[3]; int miri=1000; mpu.setGyroRange(0); while(1) { wait(1); myled = 1; wait(0.2); myled = 0; wait(0.2); timer.reset(); timer.start(); g[0] = (float)mpu.getGyroRawX()/gyro; timer.stop(); float t=timer.read(); float time=t*miri; pc.printf("time= %f ms\n",time); } }