0

I am getting b'\x00\x00\x00 ... ' together with the data I want. For example, my Arduino is writing 'hello raspberry' to RPi. At the RPi, it receives 'b'\x00\x00\x00 ... hello raspberry\r\n '. Why?

Here's my coding at RPi:

ser=serial.Serial(port='/dev/ttyS0', baudrate=9600, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_TWO, bytesize=serial.EIGHTBITS)

while True:
    x = ser.readline()
    print(x)

Whereas at Arduino Mega:

void setup()
{
    Serial3.begin(9600);
}

void loop()
{
    Serial3.println("hello raspberry");
}

1 Answers1

2

Your question is poor in detail. We are currently having difficulty reading your mind, but making a few assumptions leads me to suggest this might help:

ser=serial.Serial(port='/dev/ttyS0', baudrate=9600, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS)

If it doesn't, please read the comments, read the referenced documents in the comments, and edit your question.

Seamus
  • 23,558
  • 5
  • 42
  • 83