예제 #1
0
파일: Program.cs 프로젝트: dtbinh/ba-robot
 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();
 }
예제 #2
0
파일: Program.cs 프로젝트: dtbinh/ba-robot
 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);
 }
예제 #3
0
파일: Program.cs 프로젝트: dtbinh/ba-robot
 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);
 }