Beispiel #1
0
 private static void handleCommmands(string input, BaRobotDriverDllCSharp.BaRobot 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 "9":
             output = brw.ToString();
             break;
         case "e":
             break;
         case "OPEN":
             output = brw.OpenGripper();
             break;
         case "CLOSE":
             output = brw.CloseGripper();
             break;
         case "CLS":
             Console.Clear();
             break;
         default:
             output = brw.SendStringAndGetAnswer(input);
             speed = brw.GetSpeed();
             break;
     }
     Con.WriteLine(output);
     Con.Write("Press any key...");
     Con.ReadKey();
 }
Beispiel #2
0
 private static void DemoMode(BaRobotDriverDllCSharp.BaRobot 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.SendStringAndGetAnswer(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.SendStringAndGetAnswer(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);
 }
Beispiel #3
0
 private static void Demo2Mode(BaRobotDriverDllCSharp.BaRobot 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.SendStringAndGetAnswer(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);
 }
Beispiel #4
0
 private static void changeComport(BaRobotDriverDllCSharp.BaRobot brw)
 {
     Con.Write("Select Mode (USB or COM): ");
     string mode = Con.ReadLine();
     if (mode.ToLower() == "usb")
     {
         brw.SetMode(BaRobotDriverDllCSharp.Constants.TransferMode.USB);
         usedMode = "USB";
         usedCom = brw.GetComport();
     }
     else if (mode.ToLower() == "com")
     {
         brw.SetMode(BaRobotDriverDllCSharp.Constants.TransferMode.COM);
         usedMode = "COM";
         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());
         }
     }
     else
     {
         Con.WriteLine("Wrong Mode...");
         Con.ReadKey();
         brw.SetMode(BaRobotDriverDllCSharp.Constants.TransferMode.COM);
         usedMode = "COM";
         usedCom = brw.GetComport();
     }
 }