コード例 #1
0
ファイル: Form1.cs プロジェクト: narny14/hobbyist-repository
 private void ConnectButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (serialPort1 != null && ConnectButton.Text == "Connect")
         {
             //Open communication port
             serialPort1.PortName      = cboPortName.Text;
             serialPort1.BaudRate      = 9600;
             serialPort1.DataReceived += new SerialDataReceivedEventHandler(port_DataReceived);
             serialPort1.Open();
             ConnectButton.Text = "Disconnect";
             Info_box.Text      = "Connected successfully";
             connecting         = true;
         }
         else
         {
             serialPort1.Close();
             serialPort1.DataReceived -= new SerialDataReceivedEventHandler(port_DataReceived);
             serialPort1        = null;
             ConnectButton.Text = "Connect";
             Info_box.Text      = "Port disconnected";
             Clabel1.Hide();
             Clabel2.Hide();
             connecting = false;
         }
     }
     catch
     {
     }
 }
コード例 #2
0
ファイル: Form1.cs プロジェクト: narny14/hobbyist-repository
 private void timer1_Tick(object sender, EventArgs e)
 {
     //update_avaliable_COM_ports();
     if (temp != null)
     {
         Temp1.Text = temp[0];
         Temp2.Text = temp[1];
         Clabel1.Show();
         Clabel2.Show();
     }
 }
コード例 #3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            timer1.Interval = 500;
            timer1.Enabled  = true;
            Info_box.Text   = "Port disconnected";
            update_avaliable_COM_ports();

            //hide the degree labels
            Clabel1.Hide();
            Clabel2.Hide();
        }
コード例 #4
0
ファイル: Form1.cs プロジェクト: narny14/hobbyist-repository
        private void Form1_Load(object sender, EventArgs e)
        {
            timer1.Interval = 500;
            timer1.Enabled  = true;
            Info_box.Text   = "Port disconnected";
            update_avaliable_COM_ports();

            //hide the degree labels
            Clabel1.Hide();
            Clabel2.Hide();
            filename             = "SD_Card_data.csv";
            file_path            = "./" + filename;
            FilePathTextBox.Text = file_path;
            connecting           = false;
            start_logging        = false;
            term = new Transmission_detail_term();
            term.Hide();
        }