ジャイロ

Dependents:   00_yotsuba 103_JY901_practice 200_yotsuba_21 200_yotuba_21_uiChange

Revision:
5:2397765e5b08
Parent:
4:0f89370330ff
Child:
6:79d045ea3542
diff -r 0f89370330ff -r 2397765e5b08 jy901.cpp
--- a/jy901.cpp	Sat Dec 12 05:05:39 2020 +0000
+++ b/jy901.cpp	Fri Jan 08 10:17:46 2021 +0000
@@ -28,6 +28,19 @@
     write(IICADDR,calibrationRegistar,3,false);
 }
 
+//ここより下は長谷川が追加しました。不必要な場合は教えてください。2020/09/29
+void JY901::yawcalibrate()
+{
+    char calibrationRegistar[3]= {CALSW,0x04,0x00};
+    write(IICADDR,calibrationRegistar,3,false);
+}
+
+void JY901::algorithmtrasition()
+{
+    char calibrationRegistar[3]= {0x24,0x01,0x00};
+    write(IICADDR,calibrationRegistar,3,false);
+}
+
 void JY901::calibrateAll(int time)
 {
     calibrateGyroAccel();
@@ -37,12 +50,11 @@
     calibrateHeight();
     ThisThread::sleep_for(time);
     endCalibrate();
-}
-
-void JY901::jyroReset()
-{
-    char calibrationRegistar[3]= {0x01,0x04,0x00};
-    write(IICADDR,calibrationRegistar,3,false);
+    ThisThread::sleep_for(time);
+    algorithmtrasition();
+    ThisThread::sleep_for(time);
+    yawcalibrate();
+    
 }
 
 float JY901::getXaxisAcceleration()
@@ -125,4 +137,4 @@
     write(IICADDR,&registar,1,true);
     read(IICADDR,data,2,false);
     return data;
-}
+}
\ No newline at end of file