Exemplo n.º 1
0
        private static void TestPanMovementWithStartBeforeEndReached(ICommunication communication)
        {
            Console.WriteLine("Start");
            var panTiltControl  = new EneoPanTiltControl(communication);
            var positionChecker = new PositionChecker(panTiltControl);

            panTiltControl.PositionChanged += PanTiltControl_OnPositionChanged;

            while (true)
            {
                panTiltControl.PanAbsolute(0);
                positionChecker.ComparePosition(new PanTiltPosition(0, 0), 0.5, 20, 100);

                panTiltControl.PanAbsolute(40);
                positionChecker.ComparePosition(new PanTiltPosition(40, 0), 0.5, 20, 100);

                panTiltControl.PanRelative(-40);
                Thread.Sleep(500);

                panTiltControl.PanRelative(40);
                Thread.Sleep(500);

                panTiltControl.PanAbsolute(0);

                Console.WriteLine("Loop done");
            }
        }
Exemplo n.º 2
0
        private static void BasicMovementLogic(ICommunication communication)
        {
            while (true)
            {
                Console.WriteLine("Start");
                var panTiltControl = new EneoPanTiltControl(communication);
                panTiltControl.PositionChanged += PanTiltControl_OnPositionChanged;
                Console.WriteLine("Pan 80");
                panTiltControl.MovePanAbsolute(80);
                panTiltControl.MoveTiltAbsolute(0);
                Thread.Sleep(4000);
                Console.WriteLine("Pan 20");
                panTiltControl.MovePanAbsolute(20);
                panTiltControl.MoveTiltAbsolute(0);
                Thread.Sleep(4000);
                Console.WriteLine("Pan 80");
                panTiltControl.MovePanAbsolute(80);
                panTiltControl.MoveTiltAbsolute(0);
                Thread.Sleep(4000);
                Console.WriteLine("Pan 20");
                panTiltControl.MovePanAbsolute(20);
                panTiltControl.MoveTiltAbsolute(0);
                Thread.Sleep(4000);
                Console.WriteLine("Pan Relative 10");
                panTiltControl.PanRelative(10);
                Thread.Sleep(4000);
                Console.WriteLine("Stop Moving");
                panTiltControl.StopMoving();
                Thread.Sleep(1000);
                Console.WriteLine("Pan 20");
                panTiltControl.MovePanAbsolute(20);
                panTiltControl.MoveTiltAbsolute(0);
                Thread.Sleep(2000);

                panTiltControl.PositionChanged -= PanTiltControl_OnPositionChanged;
                panTiltControl.Dispose();
                Console.WriteLine("done");
                //Console.ReadLine();
            }
        }