예제 #1
0
파일: Program.cs 프로젝트: bollylu/Stepper
        public static void Test()
        {
            foreach (string SerialPortItem in SerialCom.GetSerialPorts())
            {
                Console.WriteLine(SerialPortItem);
            }

            Stepper CurrentStepper = new Stepper("COM4");

            MoveInfoCollection MySequence = new MoveInfoCollection();

            MySequence.AddItem(new MoveInfo(EDirection.Clockwise, 20, 1));
            //MySequence.AddItem(new MoveInfo(EDirection.Clockwise, 20, 0.8));
            //MySequence.AddItem(new MoveInfo(EDirection.Clockwise, 20, 0.6));
            //MySequence.AddItem(new MoveInfo(EDirection.Clockwise, 20, 1));
            //MySequence.AddItem(new MoveInfo(EDirection.Clockwise, 4500, 0.2));
            //MySequence.AddItem(new MoveInfo(EDirection.Clockwise, 100, 0.5));
            //MySequence.AddItem(new MoveInfo(EDirection.CounterClockwise, 4690, 0));

            for (int i = 1; i <= 10; i++)
            {
                TChrono NewChrono = new TChrono();
                NewChrono.Start();
                Task.Run(() => CurrentStepper.Execute(MySequence)).Wait();
                Console.WriteLine($"Execution time = {NewChrono.ElapsedTime.TotalMilliseconds}");
            }
            //Task.Run(() => CurrentStepper.Execute(new MoveInfo(EDirection.Clockwise, 5, 100))).Wait();
        }