从接收器读取 GPS 数据时出现奇怪的字符串

Weird strings when reading the GPS data from the receiver

我试图从接收器读取 GPS 数据。结果我得到了奇怪的字符串。问题出在哪里?

import serial

port = "/dev/ttyUSB0"    # Raspberry Pi 3

def parseGPS(data):
        print(data)
        #...

ser = serial.Serial(port, baudrate = 9600, timeout = 0.5)
while True:
    data = ser.readline()
    parseGPS(data)

结果

问题是波特率错误。下一个例子没有问题:

import serial

port = "/dev/ttyUSB0"  # Raspberry Pi 3

def parseGPS(data):
   print(data)
   # ...

ser = serial.Serial(port, baudrate=4800, timeout=0.5)
while True:
   data = ser.readline()
   parseGPS(data)