I have an Arduino program running that sets the Serial baud to 19200. I want to extract the serial data using the PySerial library. However, PySerial only seems to be working when the baud rate is at 115200.
This is how my Arduino setup() looks like:
void setup() {
// put your setup code here, to run once:
Serial.begin(19200);
XBee.begin(19200);// was 9600
}
This is how the PySerial code looks when set at 19200:
with serial.Serial('COM19', 19200) as ser:
x = ser.read(8) # 6 works for reading in 2 variables
print(x)
Output:
b'\xf3\xea\xf6\xea\xea\xf8'
b'\xf8\xf6\xf3\xfc\xfc\xfc'
This is how the PySerial code looks when set at 115200:
with serial.Serial('COM19', 115200) as ser:
x = ser.read(8) # 6 works for reading in 2 variables
print(x)
Output:
b'70\r\n72'
b'72\r\n70'
Does anyone know why it only works with 115200 and not 19200? Or what I can do to convert that datatype into a decimal number?
Thanks