Page 159 - 최강 아두이노 스마트 자동차 로봇 키트
P. 159

else
                     if (szIRCmd == "6")
                     {
                         g_carDirection = CAR_DIR_RF;
                         Serial.println("Right");
                         car_update();
                         return;
                     }
                     else
                     if (szIRCmd == "D") // continue delay.
                     {
                         delay(100); // 0.1 sec
                         return;
                     }
                     else
                     if (szIRCmd == "C") // continue delay.
                     {
                         //g_carDirection =
                         car_update();
                         return;
                     }
                     else
                     if (szIRCmd == "?") // whereToGo
                     {
                         int newDirection = whereToGo(); // 길찾기.
                         Serial.print("New Direction ");
                         Serial.println(newDirection);
                         if (newDirection == DIR_DISC_CENTER)
                         {
                             Serial.println("Forward  |||||||| ");
                             cmdEnQueue("2"); // 전방

                         }
                         else
                             //g_carDirection = CAR_DIR_FW;
                         if (newDirection == DIR_DISC_LEFT)
                         {
                             Serial.println("LEFT <<<===== ");
                             //g_carDirection = CAR_DIR_LF;
                             cmdEnQueue("4"); //
                             cmdEnQueue("D"); // delay 100 ms
                             cmdEnQueue("D"); // delay 100 ms
                             cmdEnQueue("D"); // delay 100 ms
                             cmdEnQueue("D"); // delay 100 ms






                                                   158
   154   155   156   157   158   159   160   161   162   163   164