public void draw() {
   if (serial != null) {
     ArrayList<CMS50Packet> tmp = buffer.getBuffer();
     drawWaveform(0, 0, 800, 100, tmp);
     drawSignalStrength(0, 100, 800, 100, tmp);
   }
 }
            @Override
            public void run() {
              while (true) {
                // TODO Auto-generated method stub
                // print("start");

                if (serial != null) buffer.add(device.parse(serial.input));
                try {
                  Thread.sleep(1);
                } catch (InterruptedException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
                }
              }
            }