我正在尝试使用简单的 hello world 示例从 SFM10 读取数据,
它适用于 powershell 但不使用 python
以下代码适用于 arduino
导入序列号
# 设置 5 秒超时
port = serial.Serial('COM6', 115200, bytesize=8, parity='N', stopbits=1,
timeout=5)
尝试:
line = port.readline().decode('utf-8')
print(line)
except serial.SerialTimeoutException:
print("No data received within timeout period")
最后:
port.close()