示例#1
0
        private void DisconnectArduino()
        {
            ArduinoPort.Close();
            connected = false;

            ConnectBtn.BackColor = defaultButtonColor;
            ConnectBtn.Text      = "CONNECT";
            StateLabel.Text      = "DISCONNECTED";
            StateLabel.ForeColor = Color.Crimson;
        }
示例#2
0
 static bool check_connection()
 {
     if (!ArduinoPort.IsOpen)
     {
         try
         {
             ArduinoPort.Open();
             ArduinoPort.WriteLine("T");
             ArduinoPort.Close();
         }
         catch
         {
             MessageBox.Show("There was an error. Please make sure that the correct port was selected, and that the device is plugged in.");
             return(false);
         }
         return(true);
     }
     else
     {
         return(true);
     }
 }