Advertisement
franciscominajas

Untitled

Mar 1st, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.96 KB | None | 0 0
  1. PanamaHitek_Arduino arduinouno = new PanamaHitek_Arduino();
  2.     int i;
  3.     String mensaje;
  4.     SerialPortEventListener listener=new SerialPortEventListener()
  5.     {
  6.         @Override
  7.         public void serialEvent(SerialPortEvent spe)
  8.         {
  9.             //DibujarPie();
  10.             try
  11.             {
  12.                 if (arduinouno.isMessageAvailable()==true)
  13.                 {//Si llega un valor
  14.                     mensaje=arduinouno.printMessage();
  15.                     System.out.println("-->"+mensaje);
  16.                     System.out.println("-->"+mensaje.length());
  17.                     if(mensaje.length()==12)
  18.                     {
  19.                         colocacionPanel2(mensaje);
  20.                     }
  21.                     mensaje="";
  22.                 }
  23.             }
  24.             catch (SerialPortException ex)
  25.             {
  26.  
  27.             }
  28.             catch (ArduinoException ex)
  29.             {
  30.                
  31.             }
  32.         }
  33.     };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement