public void Start_Journey() { char Destination = Convert.ToChar(destinationChar.Text[0]); List <char> shortP; PathConsole.ResetText(); Arduino.Write("R"); while (true) { while (true) { if (Arduino.BytesToRead > 0) { Arduino.DiscardInBuffer(); break; } } char current_pos = WhereAmI(GetPoint()); if (current_pos == Destination) { Arduino.Write('K'.ToString()); Task.Delay(15); break; } else { shortP = g.shortest_path(current_pos, Destination); PathConsole.AppendText(shortP[shortP.Count - 1].ToString()); Arduino.Write(shortP[shortP.Count - 1].ToString()); } } }
public void Start_Journey() { char Destination = ' '; List <char> shortP; char current_pos = WhereAmI(GetPoint()); while (true) { if (current_pos == Destination) { Arduino.Write("z"); break; } else { shortP = g.shortest_path(current_pos, Destination); PathConsole.AppendText(shortP[shortP.Capacity - 1].ToString()); Arduino.Write(shortP[shortP.Capacity - 1].ToString()); } } }