// Conexion al arduino. // Connection to Arduino. private void ConnectArduino() { string portComSelected = ComPorts.GetItemText(ComPorts.SelectedItem); ArduinoPort = new SerialPort(portComSelected, 9600, Parity.None, 8, StopBits.One); // Initialize serial port. try { Conexion = true; // Establecer la conexion en TRUE para validar. || This value validate if arduino and APP are binded. ArduinoPort.Open(); // Estilos que cambian al modificar la conexion. // EN: Styles for form button and label. Connection_btn.Text = "CLOSE"; Connection_btn.BackColor = Color.Crimson; StateLevel_lb.Text = "CONNECTED"; StateLevel_lb.ForeColor = Color.FromArgb(6, 214, 160); // ES: Activa los controles // EN: Enable the controls Red_Controller.Enabled = true; Green_Controller.Enabled = true; Blue_Controller.Enabled = true; } catch (Exception e) { MessageBox.Show("Error: " + e.Message, "EXCEPTION.", MessageBoxButtons.OK, MessageBoxIcon.Error); } }