Esempio n. 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            string[] ports = SerialPort.GetPortNames();
            Array.Sort(ports);
            cbCom.Items.Clear();
            cbCom.Items.AddRange(ports);
            cbCom.Items.Add("刷新");
            cbCom.SelectedIndex = 0;
            if (Properties.Settings.Default.PortName != "")
            {
                for (int i = 0; i < cbCom.Items.Count; i++)
                {
                    if (cbCom.Items[i].ToString() == Properties.Settings.Default.PortName)
                    {
                        cbCom.SelectedIndex = i;
                        break;
                    }
                }
            }
            sensorSingIn = new _SensorSignIn();
            sensorBAT    = new _SensorBAT();
//             double yValue = 50.0;
//             Random random = new Random();
//             for (int pointIndex = 0; pointIndex < 20000; pointIndex++)
//             {
//                 yValue = yValue + (random.NextDouble() * 10.0 - 5.0);
//                 chart1.Series[0].Points.AddY(yValue);
//             }

//             RxPacket = new CP1616Packet();
//             this.Uart.DataReceived += new System.IO.Ports.SerialDataReceivedEventHandler(this.Uart_DataReceived);
        }
Esempio n. 2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //timer1.Enabled = true;
            sensorSingIn = new _SensorSignIn();
            sensorBAT    = new _SensorBAT();
//             double yValue = 50.0;
//             Random random = new Random();
//             for (int pointIndex = 0; pointIndex < 20000; pointIndex++)
//             {
//                 yValue = yValue + (random.NextDouble() * 10.0 - 5.0);
//                 chart1.Series[0].Points.AddY(yValue);
//             }

//             RxPacket = new CP1616Packet();
//             this.Uart.DataReceived += new System.IO.Ports.SerialDataReceivedEventHandler(this.Uart_DataReceived);
        }