Example #1
0
        :return: Returns the data received from the serial port
        """
        # TODO: Trouver une facon de mettre un vrai timeout sur readline
        print('Reading port...')
        self.ser.flush()
        while True:
            message = ''
            message = self.ser.readline()[:-2]
            message = str(message)
            print(message)
            return message

    def readNow(self):
        message = ''
        message = self.ser.readline()[:-2]
        message = str(message)
        print(message)
        self.ser.flush()
        return message

        
    def writePort(self, packet):
        """ This function writes the input packet to the serial port
        :param packet: Information packet to send to serial port
        :return: None
        """
        self.ser.write(packet)

if __name__ == '__main__':
    MainGui.main()