コード例 #1
0
        public MainController()
        {
            if (m_motor == null)
            {
                try
                {
                    PhidgetMotor.MotorCallback p = new PhidgetMotor.MotorCallback(MotorFunctionCallback);
                    m_motor = new GojiMotor(p);
                    m_sendWatch.Restart();
                    using (var ctx = new PicardDb())
                    {
                        List <AppConfig> data = (from r in ctx.m_appConfig
                                                 select r).ToList();

                        m_motor.SetMotorLength(data[0].MotorLength);
                        m_motor.MaxLength = data[0].MaxLength;
                        m_motor.MinLength = data[0].MinLength;
                        m_motor.SetPrecisionOnStop(0.25f);
                    }
                }
                catch (Exception err)
                {
                    Console.WriteLine(err.Message);
                }
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: EliArad/MVCAngular
 void Initialize()
 {
     lock (this)
     {
         try
         {
             Control.CheckForIllegalCrossThreadCalls = false;
             PhidgetMotor.MotorCallback p = new PhidgetMotor.MotorCallback(MotorFunctionCallback);
             m_motor = new GojiMotor(p);
             m_motor.SetMotorLength(int.Parse(textBox3.Text));
             m_motor.SetAlphaConstant(60);
             m_initialized = true;
         }
         catch (Exception err)
         {
             MessageBox.Show(err.Message);
         }
     }
 }