/// <summary> /// Method the send a command to the Arduino board. /// </summary> /// <param name="cmd">Command information</param> private void SendCommand(ARDUINO_COMMANDS cmd) { if (!this.mSerialPort.IsOpen) { try { this.mSerialPort.Open(); this.mSerialPort.Write(Convert.ToChar(cmd).ToString()); this.mSerialPort.Close(); } catch { System.Windows.Forms.MessageBox.Show("Arduino board cannot be found. \nPlease make sure that the correct COM port was selected and the Arduino device was plugged in."); } } }