Exemplo n.º 1
0
 private static void handleCommmands(string input, BaRobotLibrary.BaRobotWrapper brw)
 {
     DateTime start = DateTime.Now;
     string output = String.Empty;
     switch (input)
     {
         case "1":
             if (brw.StartCommunication())
                 output = "Device Successfully connected";
             else
                 output = "Could not connect Device";
             break;
         case "2":
             if (brw.StopCommunication())
                 output = "Device Successfully disconnected";
             else
                 output = "Could not disconnect Device. Was it connected?";
             break;
         case "3":
             //TODO: Sendstring
             break;
         case "4":
             output = brw.StoreCommandList(STORE, STORE.Length);
             break;
         case "5":
             output = brw.GetCommandList();
             break;
         case "6":
             output = brw.EraseCommandList();
             break;
         case "7":
             Console.WriteLine("Demo2Mode Started!!!");
             Demo2Mode(brw);
             break;
         case "8":
             changeComport(brw);
             break;
         case "e":
             break;
         case "OPEN":
             output = brw.OpenGripper();
             break;
         case "CLOSE":
             output = brw.CloseGripper();
             break;
         case "CLS":
             Console.Clear();
             break;
         default:
             output = brw.SendString(input);
             speed = brw.GetSpeed();
             break;
     }
     Con.WriteLine(output);
     Con.Write("Press any key...");
     Con.ReadKey();
 }
Exemplo n.º 2
0
 private static void DemoMode(BaRobotLibrary.BaRobotWrapper brw)
 {
     String executeCommand = "ON";
     DateTime end = DateTime.Now;
     DateTime start = DateTime.Now;
     String output = brw.StartCommunication().ToString();
     end = DateTime.Now;
     PrintMessage(executeCommand, output, start, end);
     System.Threading.Thread.Sleep(sleepSeconds[speed]);
     executeCommand = "MOVE;0;15;1;120;2;140;3;120;4;90";
     start = DateTime.Now;
     output = brw.SendString(executeCommand).ToString();
     end = DateTime.Now;
     PrintMessage(executeCommand, output, start, end);
     System.Threading.Thread.Sleep(7000);
     executeCommand = "MOVE;0;165;1;90;2;160;3;180;4;30";
     start = DateTime.Now;
     output = brw.SendString(executeCommand).ToString();
     end = DateTime.Now;
     PrintMessage(executeCommand, output, start, end);
     System.Threading.Thread.Sleep(7000);
     executeCommand = "OFF";
     start = DateTime.Now;
     output = brw.StopCommunication().ToString();
     end = DateTime.Now;
     PrintMessage(executeCommand, output, start, end);
 }
Exemplo n.º 3
0
 private static void Demo2Mode(BaRobotLibrary.BaRobotWrapper brw)
 {
     String executeCommand = "ON";
     DateTime end = DateTime.Now;
     DateTime start = DateTime.Now;
     String output = String.Empty;
     if (brw.StartCommunication())
         output = "Device Successfully connected";
     else
         output = "Could not connect Device";
     end = DateTime.Now;
     PrintMessage(executeCommand, output, start, end);
     System.Threading.Thread.Sleep(sleepSeconds[speed]);
     
     executeCommand = "LISTPOS;0;1;2";
     start = DateTime.Now;
     output = brw.SendString(executeCommand).ToString();
     end = DateTime.Now;
     PrintMessage(executeCommand, output, start, end);
     System.Threading.Thread.Sleep(15000);
     
     executeCommand = "OFF";
     start = DateTime.Now;
     if (brw.StopCommunication())
         output = "Device Successfully disconnected";
     else
         output = "Could not disconnect Device. Was it connected?";
     end = DateTime.Now;
     PrintMessage(executeCommand, output, start, end);
 }
Exemplo n.º 4
0
 private static void changeComport(BaRobotLibrary.BaRobotWrapper brw)
 {
     string comp = String.Empty;
     Con.Write("Comport Number: ");
     comp = Con.ReadLine();
     try
     {
         int temp = Convert.ToInt32(comp);
         brw.SetComPort(temp);
         usedCom = temp;
     }
     catch (Exception e)
     {
         Con.WriteLine(e.ToString());
     }
 }