Esempio n. 1
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     windSpeed        = Convert.ToInt64(getReal(getSpe()), 16) / 10.00;
     labelwinSpe.Text = windSpeed.ToString("F1") + "m/s";
     windDir          = labelwinDir.Text = getStrDir(getReal(getDir()));
     winDirPic(windDir);
     labelPot.Text = potency + " ppm";
     comPort.WriteData(SerialPortUtil.HexToByte("01"));
     writeData();
     string a = potency + " " + windSpeed.ToString() + " " + windDir;
 }
Esempio n. 2
0
        /// <summary>
        /// 发送数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSend_Click(object sender, EventArgs e)
        {
            string msg = txtSendData.Text;

            serial.WriteData(msg);
        }
Esempio n. 3
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (button2.Text == "应急模拟")
     {
         pp = true;
         timer2.Start();
         textBox1.AppendText("泄漏发生");
         button2.Text = "取消模拟";
     }
     else
     {
         pp = false;
         timer2.Stop();
         gateLight1("blue");
         gateLight2("blue");
         gateLight3("blue");
         gateLight4("blue");
         gateLight5("blue");
         gateLight6("blue");
         gateLight7("blue");
         gateLight8("blue");
         comPort1.WriteData(SerialPortUtil.HexToByte("20"));
         textBox1.AppendText("取消警报");
         button2.Text = "应急模拟";
     }
 }