コード例 #1
0
ファイル: Program.cs プロジェクト: CoryNessCTR/HERO-Examples
        public static void Main()
        {
            TalonSrx       test  = new TalonSrx(0);
            GameController stick = new GameController(UsbHostDevice.GetInstance(0), 0);

            /* loop forever */
            while (true)
            {
                if (stick.GetConnectionStatus() == UsbDeviceConnection.Connected)
                {
                    CTRE.Watchdog.Feed();
                }

                //This call is redundant but you can un-comment to guarantee limit switches will work or change the mode.
                //test.ConfigLimitMode(TalonSrx.LimitMode.kLimitMode_SwitchInputsOnly);

                Debug.Print("Rev: " + test.IsRevLimitSwitchClosed() + "  | Fwd: " + test.IsFwdLimitSwitchClosed());
                Debug.Print("" + test.GetFaults());

                if (stick.GetButton(1))
                {
                    test.ClearStickyFaults();
                }


                test.Set(stick.GetAxis(1));

                /* wait a bit */
                System.Threading.Thread.Sleep(10);
            }
        }