private void DisconnectArduino() { ArduinoPort.Close(); connected = false; ConnectBtn.BackColor = defaultButtonColor; ConnectBtn.Text = "CONNECT"; StateLabel.Text = "DISCONNECTED"; StateLabel.ForeColor = Color.Crimson; }
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); } }