Ejemplo n.º 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);
                }
            }
        }
Ejemplo n.º 2
0
 private void textBox8_TextChanged(object sender, EventArgs e)
 {
     if (m_initialized == false)
     {
         Initialize();
     }
     if (m_motor != null)
     {
         try
         {
             float precision = float.Parse(textBox8.Text);
             m_motor.SetPrecisionOnStop(precision);
         }
         catch (Exception err)
         {
         }
     }
 }