The value send from arduino is 10x12
the data coming to the python slell is b'10x12\r\n'
Dear I need to decode the carriage return from the data coming from Arduino Serial port . So I decode it
Therefore I used
// the value is from arduino_data
//Then I split it by x to found 10 and 12 because x is my data separator
It is come back \r\n to the second value '12\r\n']
Please advice
---------------------------
full code
the data coming to the python slell is b'10x12\r\n'
Dear I need to decode the carriage return from the data coming from Arduino Serial port . So I decode it
Therefore I used
arduino = serial.Serial('COM15',9600) arduino_data = arduino.readline() print(arduino_data)
// the value is from arduino_data
b'10x12\r\n'// the result is showing in python shellafter decode the arduino_data
values = str(arduino_data[0:len(arduino_data)].decode("utf-8")) print(values)
10x12 / the result is showing in the python shell// The print of "value" is 10x12 after decode that is what I need
//Then I split it by x to found 10 and 12 because x is my data separator
list_values = values.split('x') print(list_values)After split the list_value is ['10', '12\r\n']
It is come back \r\n to the second value '12\r\n']
Please advice
---------------------------
full code
ist_values = [] value = [] import serial arduino = serial.Serial('COM15',9600) arduino_data = arduino.readline() print(arduino_data) values = str(arduino_data[0:len(arduino_data)].decode("utf-8")) print(values) list_values = values.split('x') print(list_values) value_1 = (list_values[0:2]) value_2 = (list_values[0:1]) print(value_1) print(value_2)