Made a parsing function for the serial port