code to test the serial port