otamesi

Dependencies:   mbed

Revision:
24:a09b08663a7c
Parent:
22:1e01f4f7097c
Child:
25:6680d67bdf24
--- a/main.cpp	Thu Dec 06 10:23:58 2018 +0000
+++ b/main.cpp	Fri Dec 07 12:45:05 2018 +0000
@@ -86,7 +86,7 @@
     }    
     fprintf(fp,"GPS finish\r\n");
  //   fclose(fp);                     // GPSの測定終了 
-    
+   
   
     
      
@@ -128,14 +128,21 @@
 if(92.5<heading<=270.0){
     motor1.speed(mcn1);
     motor2.speed(-mcn2);
-    wait(heading*0.01); //角度のずれ*1度回転するのにかかる時間
+    wait((heading-90.0)*0.004722); //角度のずれ*1度回転するのにかかる時間
     motor1.stop(0);
     motor2.stop(0);
     wait(1);
-}else if(270.0<heading<PI2 && 0<=heading<87.5){
+}else if(270.0<heading<PI2){
     motor1.speed(-mcn1);
     motor2.speed(mcn2);
-    wait((PI2-heading)*0.01);
+    wait((PI2-heading+90.0)*0.004722);
+    motor1.stop(0);
+    motor2.stop(0);
+    wait(1);
+}else if(0<=heading<87.5){
+    motor1.speed(-mcn1);
+    motor2.speed(mcn2);
+    wait((90.0-heading)*0.004722);
     motor1.stop(0);
     motor2.stop(0);
     wait(1);