Close

Solving the x00 Serial Arduino Problem

A project log for Gesture Controlled Smartwatch

A larger, more functional smartwatch with gesture controllability

thomas-mckinneyThomas McKinney 03/04/2019 at 18:160 Comments

Well I have found a solution to this Serial Connection x00 problem:

By including an if statement which looks at the serial port incoming data, and if it doesn't match a certain format of 5 numbers, like the expected, correct incoming data from the FSR Sensors:

0, 0, 0, 0, 0 

then it will dump the reading, and replace it with a reading of zeros, like above. Now only the correct formatted readings are delivered to the List in the Kivy GUI app code, and no longer any issues with the numeric property that defines said list. 

This solution, I think, will actually help against all kinds of potential future bugs from the sensor data incoming along the serial connection. 

This is the code in the arduinothread.py file I have included:

    def read_serial(self):
        """Returns a list of from serial monitor."""
        reading = self.serial.readline().decode('utf-8')
        reading = reading.strip('\r\n').split(',')
        if len(reading) == 5:
            return reading
        else:
            return [0, 0, 0, 0, 0]

Discussions