예제 #1
0
 public void conectarSerial()
 {
     if (serialArduino.IsOpen == false)
     {
         try
         {
             listconfiguracao = bllconfiguracao.getAllCustom();
             string[] ports = SerialPort.GetPortNames();
             foreach (string port in ports)
             {
                 if (listconfiguracao[0].porta_arduino == port)
                 {
                     serialArduino.PortName = listconfiguracao[0].porta_arduino;
                     serialArduino.BaudRate = listconfiguracao[0].baud_rate;
                     serialArduino.StopBits = StopBits.Two;
                     serialArduino.Open();
                 }
             }
         }
         catch
         {
             serialArduino.Close();
             return;
         }
     }
     else
     {
         try
         {
             //serialArduino.Close();
         }
         catch
         {
             return;
         }
     }
 }
예제 #2
0
 public frmStatus()
 {
     InitializeComponent();
     list = bll.getAllCustom();
     conectarSerial();
 }