code to read serial port offline