伊與部 聡 / Mbed 2 deprecated MPU6050_test_AAA

Dependencies:   mbed MPU6050_testAAAAAAAAAAAAA

Files at this revision

API Documentation at this revision

Comitter:
Satoshisatoshi
Date:
Sat May 08 02:45:22 2021 +0000
Parent:
2:6e9393d9cc11
Commit message:
AAAAAAAAAAAAAA

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
--- a/MPU6050.lib	Thu Aug 15 03:42:49 2019 +0000
+++ b/MPU6050.lib	Sat May 08 02:45:22 2021 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/ritarosakai/code/MPU6050/#a993e922395d
+https://os.mbed.com/users/Satoshisatoshi/code/MPU6050_testAAAAAAAAAAAAA/#5af7c813fbbc
--- a/main.cpp	Thu Aug 15 03:42:49 2019 +0000
+++ b/main.cpp	Sat May 08 02:45:22 2021 +0000
@@ -1,26 +1,23 @@
 #include "mbed.h"
 #include "MPU6050.h"
 
-MPU6050 mpu(D4,D5);
+MPU6050 mpu1(p9,p10,0x68);
+//MPU6050 mpu2(p9,p10,0x69);
 Serial pc(USBTX,USBRX);
 
 float gx,gy,gz,ax,ay,az;
 
 int main()
 {
-    pc.baud(115200);
-    if(mpu.getID()==0x68) {
-        pc.printf("MPU6050 OK");
+    pc.baud(9600);
+
+    mpu1.start();
+//    mpu2.start();
+    while(1) {
+        mpu1.read(&gx,&gy,&gz,&ax,&ay,&az);
+        pc.printf("ax,ay,az %.2f,%.2f,%.2f\r\n",ax,ay,az);
+//        mpu2.read(&gx,&gy,&gz,&ax,&ay,&az);
+//        pc.printf("     ax,ay,az %.2f,%.2f,%.2f\r\n",ax,ay,az);
         wait(1);
-    } else {
-        pc.printf("MPU6050 error ID=0x%x\r\n",mpu.getID());
-        while(1) {
-        }
-    }
-    mpu.start();
-    while(1) {
-        mpu.read(&gx,&gy,&gz,&ax,&ay,&az);
-        pc.printf("gx,gy,gz,ax,ay,az %.1f,%.1f,%.1f,%.2f,%.2f,%.2f\r\n",gx,gy,gz,ax,ay,az);
-        wait(0.1);
     }
 }