コード例 #1
0
        private void Gogogo()
        {
            int distance = 3500;

            Commands.SendCommand("D+" + distance);

            decision = Commands.WhichSide(Commands.Checkk(Cheeckk));
            int checkPath = 0;

            if (decision == 0 || decision == 1)
            {
                GoToObstacle(decision);
                start = DateTime.Now;
                Thread.Sleep(2000);
                PassingObstacle(decision);
                stop = DateTime.Now;
                TimeSpan roznica = stop - start;
                int      roznn   = Convert.ToInt32(roznica.TotalMilliseconds);
                CheckEdges(decision);
                Thread.Sleep(1000);
                checkPath = ComeBackToPath(decision);
                if (checkPath == 1)
                {
                    ReturnToPath(decision, roznn);
                    GoStraight();
                    Commands.SendCommand("H");
                }
                else
                {
                    Commands.SendCommand("H");
                    Commands.SendCommand("!");
                    MessageBox.Show("Koniec jazdy");
                    return;
                }
                MessageBox.Show("Koniec jazdy");
            }
            else
            {
                GoStraight();
                Commands.SendCommand("H");
                MessageBox.Show("Koniec jazdy");
            }
        }