Python serial.PARITY_ODD Examples

The following are 7 code examples of serial.PARITY_ODD(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module serial , or try the search function .
Example #1
Source File: auto_cal_p5.py    From MPMD-AutoBedLevel-Cal with MIT License 6 votes vote down vote up
def establish_serial_connection(port, speed=115200, timeout=10, writeTimeout=10000):
    # Hack for USB connection
    # There must be a way to do it cleaner, but I can't seem to find it
    try:
        temp = Serial(port, speed, timeout=timeout, writeTimeout=writeTimeout, parity=PARITY_ODD)
        if sys.platform == 'win32':
            temp.close()
        conn = Serial(port, speed, timeout=timeout, writeTimeout=writeTimeout, parity=PARITY_NONE)
        conn.setRTS(False)#needed on mac
        if sys.platform != 'win32':
            temp.close()
        return conn
    except SerialException as e:
        print ("Could not connect to {0} at baudrate {1}\nSerial error: {2}".format(port, str(speed), e))
        return None
    except IOError as e:
        print ("Could not connect to {0} at baudrate {1}\nIO error: {2}".format(port, str(speed), e))
        return None 
Example #2
Source File: auto_cal.py    From MPMD-AutoBedLevel-Cal with MIT License 6 votes vote down vote up
def establishSerialConnection(port, speed=115200, timeout=10, writeTimeout=10000):
        # Hack for USB connection
        # There must be a way to do it cleaner, but I can't seem to find it
        try:
            temp = Serial(port, speed, timeout=timeout, writeTimeout=writeTimeout, parity=PARITY_ODD)
            if sys.platform == 'win32':
                temp.close()
            conn = Serial(port, speed, timeout=timeout, writeTimeout=writeTimeout, parity=PARITY_NONE)
            conn.setRTS(False) #needed on mac
            if sys.platform != 'win32':
                temp.close()
            return conn
        except SerialException as e:
            print ("Could not connect to {0} at baudrate {1}\nSerial error: {2}".format(port, str(speed), e))
            raise e
        except IOError as e:
            print ("Could not connect to {0} at baudrate {1}\nIO error: {2}".format(port, str(speed), e))
            raise e 
Example #3
Source File: auto_cal_marlin4mpmd.py    From MPMD-AutoBedLevel-Cal with MIT License 6 votes vote down vote up
def establish_serial_connection(port, speed=115200, timeout=10, writeTimeout=10000):
    # Hack for USB connection
    # There must be a way to do it cleaner, but I can't seem to find it
    try:
        temp = Serial(port, speed, timeout=timeout, writeTimeout=writeTimeout, parity=PARITY_ODD)
        if sys.platform == 'win32':
            temp.close()
        conn = Serial(port, speed, timeout=timeout, writeTimeout=writeTimeout, parity=PARITY_NONE)
        conn.setRTS(False)#needed on mac
        if sys.platform != 'win32':
            temp.close()
        return conn
    except SerialException as e:
        print ("Could not connect to {0} at baudrate {1}\nSerial error: {2}".format(port, str(speed), e))
        return None
    except IOError as e:
        print ("Could not connect to {0} at baudrate {1}\nIO error: {2}".format(port, str(speed), e))
        return None 
Example #4
Source File: auto_cal_v2.py    From MPMD-AutoBedLevel-Cal with MIT License 6 votes vote down vote up
def establish_serial_connection(port, speed=115200, timeout=10, writeTimeout=10000):
    # Hack for USB connection
    # There must be a way to do it cleaner, but I can't seem to find it
    try:
        temp = Serial(port, speed, timeout=timeout, writeTimeout=writeTimeout, parity=PARITY_ODD)
        if sys.platform == 'win32':
            temp.close()
        conn = Serial(port, speed, timeout=timeout, writeTimeout=writeTimeout, parity=PARITY_NONE)
        conn.setRTS(False)#needed on mac
        if sys.platform != 'win32':
            temp.close()
        return conn
    except SerialException as e:
        print ("Could not connect to {0} at baudrate {1}\nSerial error: {2}".format(port, str(speed), e))
        return None
    except IOError as e:
        print ("Could not connect to {0} at baudrate {1}\nIO error: {2}".format(port, str(speed), e))
        return None 
Example #5
Source File: cms50dplus.py    From CMS50Dplus with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def connect(self):
        if self.conn is None:
            self.conn = serial.Serial(port = self.port,
                                      baudrate = 19200,
                                      parity = serial.PARITY_ODD,
                                      stopbits = serial.STOPBITS_ONE,
                                      bytesize = serial.EIGHTBITS,
                                      timeout = 5,
                                      xonxoff = 1)
        elif not self.isConnected():
            self.conn.open() 
Example #6
Source File: vrhand_vive_tracker.py    From soccer-matlab with BSD 2-Clause "Simplified" License 4 votes vote down vote up
def getSerialOrNone(portname):
    try:
       return serial.Serial(port=portname,baudrate=115200,parity=serial.PARITY_ODD,stopbits=serial.STOPBITS_TWO,bytesize=serial.SEVENBITS)
    except:
       return None 
Example #7
Source File: hand.py    From soccer-matlab with BSD 2-Clause "Simplified" License 4 votes vote down vote up
def getSerialOrNone(portname):
    try:
       return serial.Serial(port=portname,baudrate=115200,parity=serial.PARITY_ODD,stopbits=serial.STOPBITS_TWO,bytesize=serial.SEVENBITS)
    except:
       return None