Open a tcp socket and continuously read the stream in a non-working way. Items in the stream are seperated by a cartridge return. Use regex to remove the non numeric characters but allowing the decimal point from the item and add each cleaned item to a public queue named rawData.
def read_data(self): self.socket.sendall('s\r'.encode()) while True: data = self.socket.recv(1024) for line in data.split('\r'): m = re.match(r'\d*\.\d*',line) if m: self.raw_data.put(float(m.group()))