linetrace saikyou

Dependencies:   RemoteIR TextLCD

Revision:
41:3c58a4be1199
Parent:
40:75e1ad7c27e4
Child:
42:56022456ef23
--- a/main.cpp	Wed Aug 19 06:07:00 2020 +0000
+++ b/main.cpp	Wed Aug 19 06:32:06 2020 +0000
@@ -369,6 +369,8 @@
         }else{                                // 障害物がある場合                   
             i = 0;
             if(SC < 15){                     // 正面15cm以内に障害物が現れた場合
+                servo.pulsewidth_us(1450);      // サーボを中央位置に戻す
+                ThisThread::sleep_for(100);     // 100ms待つ
                 run = BACK;                  // 後退
                 int cnt_kyori=0;
                 int kyori = watch();
@@ -474,11 +476,11 @@
         flag_a = 0;                   // 障害物有無フラグを0にセット
         if(SLD < 29){                     // 正面15cm以内に障害物が現れた場合
                 run = RIGHT;                 // 右折
-                ThisThread::sleep_for(100);  // 100ms待つ
+                ThisThread::sleep_for(200);  // 100ms待つ
                 run = STOP;                  // 停止
         }else if(SRD < 29){
                 run = LEFT;                  // 左折
-                ThisThread::sleep_for(100);  // 100ms待つ
+                ThisThread::sleep_for(200);  // 100ms待つ
                 run = STOP;                  // 停止
         }      
     }