Beispiel #1
0
        static void Main(string[] args)
        {
            KinectMotor motor = new KinectMotor();

            if( args.Length ==1 )
            {
                if( args[0] == "--horizon" )
                {
                    // Demonstrate horizon following
                    Console.WriteLine("Press any key to exit");
                    while(Console.KeyAvailable == false)
                    {
                        motor.SetTilt(0);
                        Thread.Sleep(TimeSpan.FromMilliseconds(100));
                    }
                }else{
                    // User defined value
                    sbyte pos = sbyte.Parse(args[0]);
                    motor.SetTilt(pos);
                }
            }else{
                Usage();

                Console.WriteLine("Demo sequence started");

                // Sample Sequence
                ExerciseMotor(motor,+50);
                ExerciseMotor(motor,-50);
                ExerciseMotor(motor,+60);
                ExerciseMotor(motor,-60);
                ExerciseMotor(motor, 0);
            }

            Console.WriteLine("done");
        }
Beispiel #2
0
 private static void ExerciseMotor(KinectMotor motor, sbyte pos)
 {
     motor.SetLED(KinectLEDStatus.AlternateRedYellow);
     motor.SetTilt(pos);
     Thread.Sleep(TimeSpan.FromSeconds(2));
     motor.SetLED(KinectLEDStatus.Green);
 }
        private static void ExerciseMotor()
        {
            KinectMotor motor = new KinectMotor();

            motor.SetTilt(50);
            motor.SetLED(KinectLEDStatus.Red);
            Thread.Sleep(TimeSpan.FromSeconds(2));

            motor.SetTilt(255);
            motor.SetLED(KinectLEDStatus.BlinkingYellow);
            Thread.Sleep(TimeSpan.FromSeconds(2));

            motor.SetTilt(128);
            motor.SetLED(KinectLEDStatus.AlternateRedGreen);
            Thread.Sleep(TimeSpan.FromSeconds(2));

            motor.SetLED(KinectLEDStatus.Green);
        }