private void SpeedDetection_Load(object sender, EventArgs e)
 {
     pc = new PortControl(0);
     pc.AnalogPortConfigurationIn();
     pc.AnalogPortConfigurationOut();
     pc.DigitalConfigurationOut();
 }
 private void Replay_Load(object sender, EventArgs e)
 {
     pc = new PortControl(0);
     pc.AnalogPortConfigurationIn();
     pc.AnalogPortConfigurationOut();
     pc.DigitalConfigurationOut();
     timer1.Interval = 100;
 }
Exemplo n.º 3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            pc = new PortControl(0);
            pc.AnalogPortConfigurationIn();
            pc.DigitalConfigurationOut();
            pc.AnalogPortConfigurationOut();


            ifStartDebugMode = true;


            timer1.Interval = 100;
            timer2.Interval = 100;
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            board.AnalogPortConfigurationOut();
            board.DigitalConfigurationOut();
            timer1.Interval = 100;
            timer2.Interval = 100;
            board.DigitOutput(0, MccDaq.DigitalLogicState.Low);
            CoreSerialize cs = new CoreSerialize();

            TParameters dataT = new TParameters();

            try
            {
                dataT = cs.TParamDeSerializeNow();

                tbLastTime_1.Text     = dataT.lastTime_1.ToString();
                tbIntervalTime_1.Text = dataT.intervalTime_1.ToString();
                tbCircle_1.Text       = dataT.circle_1.ToString();
                tbVoltage_1.Text      = dataT.voltage_1.ToString();

                tbLastTime_2.Text     = dataT.lastTime_2.ToString();
                tbIntervalTime_2.Text = dataT.intervalTime_2.ToString();
                tbCircle_2.Text       = dataT.circle_2.ToString();
                tbVoltage_2.Text      = dataT.voltage_2.ToString();

                tbLastTime_3.Text     = dataT.lastTime_3.ToString();
                tbIntervalTime_3.Text = dataT.intervalTime_3.ToString();
                tbCircle_3.Text       = dataT.circle_3.ToString();
                tbVoltage_3.Text      = dataT.voltage_3.ToString();

                tbLastTime_4.Text     = dataT.lastTime_4.ToString();
                tbIntervalTime_4.Text = dataT.intervalTime_4.ToString();
                tbCircle_4.Text       = dataT.circle_4.ToString();
                tbVoltage_4.Text      = dataT.voltage_4.ToString();
            }
            catch
            {
                TParameters tp = new TParameters()
                {
                    lastTime_1     = 3,
                    intervalTime_1 = 3,
                    circle_1       = 3,
                    voltage_1      = 3.5,

                    lastTime_2     = 3,
                    intervalTime_2 = 3,
                    circle_2       = 3,
                    voltage_2      = 3.5,

                    lastTime_3     = 3,
                    intervalTime_3 = 3,
                    circle_3       = 3,
                    voltage_3      = 3.5,

                    lastTime_4     = 3,
                    intervalTime_4 = 3,
                    circle_4       = 3,
                    voltage_4      = 3.5,
                };

                cs.TParammSerializeNow(tp);

                dataT                 = cs.TParamDeSerializeNow();
                tbLastTime_1.Text     = dataT.lastTime_1.ToString();
                tbIntervalTime_1.Text = dataT.intervalTime_1.ToString();
                tbCircle_1.Text       = dataT.circle_1.ToString();
                tbVoltage_1.Text      = dataT.voltage_1.ToString();

                tbLastTime_2.Text     = dataT.lastTime_2.ToString();
                tbIntervalTime_2.Text = dataT.intervalTime_2.ToString();
                tbCircle_2.Text       = dataT.circle_2.ToString();
                tbVoltage_2.Text      = dataT.voltage_2.ToString();

                tbLastTime_3.Text     = dataT.lastTime_3.ToString();
                tbIntervalTime_3.Text = dataT.intervalTime_3.ToString();
                tbCircle_3.Text       = dataT.circle_3.ToString();
                tbVoltage_3.Text      = dataT.voltage_3.ToString();

                tbLastTime_4.Text     = dataT.lastTime_4.ToString();
                tbIntervalTime_4.Text = dataT.intervalTime_4.ToString();
                tbCircle_4.Text       = dataT.circle_4.ToString();
                tbVoltage_4.Text      = dataT.voltage_4.ToString();
            }
        }
Exemplo n.º 5
0
        private void Form1_Load(object sender, EventArgs e)
        {
            pc = new PortControl(0);
            pc.AnalogPortConfigurationIn();
            pc.AnalogPortConfigurationOut();
            pc.DigitalConfigurationOut();
            pc.ClearALLDigitalPort();
            positionForEverySequence    = new List <List <float> >();
            torqueForEverySequence      = new List <List <float> >();
            RightOrLeftForEverySequence = new List <List <int> >();
            cc = new CoreControl();
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景.
            SetStyle(ControlStyles.DoubleBuffer, true);         // 双缓冲
            StreamReader sR     = File.OpenText(Application.StartupPath + "\\set-1.txt");
            int          length = int.Parse(sR.ReadLine());

            for (int i = 0; i != length; i++)
            {
                string temp = sR.ReadLine();
                if (temp == "Train")
                {
                    trainOrTest_1.Add(true);
                    experimentTime_1.Add(int.Parse(sR.ReadLine()));
                    lbExpSequence_1.Items.Add(trainOrTest_1.Count.ToString("00") + "   " + "Train  " + experimentTime_1[i] + "s");
                }
                else
                {
                    trainOrTest_1.Add(false);
                    experimentTime_1.Add(int.Parse(sR.ReadLine()));
                    lbExpSequence_1.Items.Add(trainOrTest_1.Count.ToString("00") + "   " + "Test   " + experimentTime_1[i] + "s");
                }
            }
            sR.Close();


            StreamReader sR2     = File.OpenText(Application.StartupPath + "\\set-2.txt");
            int          length2 = int.Parse(sR2.ReadLine());

            for (int i = 0; i != length2; i++)
            {
                string temp = sR2.ReadLine();
                if (temp == "Train")
                {
                    trainOrTest_2.Add(true);
                    experimentTime_2.Add(int.Parse(sR2.ReadLine()));
                    lbExpSequence_2.Items.Add(trainOrTest_2.Count.ToString("00") + "   " + "Train  " + experimentTime_2[i] + "s");
                }
                else
                {
                    trainOrTest_2.Add(false);
                    experimentTime_2.Add(int.Parse(sR2.ReadLine()));
                    lbExpSequence_2.Items.Add(trainOrTest_2.Count.ToString("00") + "   " + "Test   " + experimentTime_2[i] + "s");
                }
            }
            sR2.Close();

            StreamReader sR3     = File.OpenText(Application.StartupPath + "\\set-2.txt");
            int          length3 = int.Parse(sR3.ReadLine());

            for (int i = 0; i != length3; i++)
            {
                string temp = sR3.ReadLine();
                if (temp == "Train")
                {
                    trainOrTest_3.Add(true);
                    experimentTime_3.Add(int.Parse(sR3.ReadLine()));
                    lbExpSequence_3.Items.Add(trainOrTest_3.Count.ToString("00") + "   " + "Train  " + experimentTime_3[i] + "s");
                }
                else
                {
                    trainOrTest_3.Add(false);
                    experimentTime_3.Add(int.Parse(sR3.ReadLine()));
                    lbExpSequence_3.Items.Add(trainOrTest_3.Count.ToString("00") + "   " + "Test   " + experimentTime_3[i] + "s");
                }
            }
            sR3.Close();



            v = new visionStimulation();
            v.Show();

            timer1.Interval = 10;
            timer2.Interval = 100;
        }