@Override
    public void serialEvent(SerialPortEvent event)
    {
        if(!event.isRXCHAR())
            return;
        int n = event.getEventValue();
        try
        {
            byte buffer[] = serialPort.readBytes(n);
            for(byte b : buffer)
            {
                if(b == '\n')
                {
                    broadcastTick(System.currentTimeMillis());
                    data = new StringBuffer();
                } else if(b != '\r')
                    data.append(b);
            }
        } catch(SerialPortException ex)
        {
            System.out.println(ex);
        }
    }