Raspberry Pi Xbee serial.Serial 超时不工作 Python

Raspberry Pi Xbee serial.Serial timeout not working Python

我正在尝试将 Rasberry Pi 与 UART 接头 ttyAMA0 上的 Xbee 连接

两者都已连接,我收到 +++ -> OK 的响应

Xbee 处于模式 2 API

s = serial.Serial("/dev/ttyAMA0", 9600, timeout=5)
xb = ZigBee(s)
xb.send('at', command="SH")
print "working till now"
ansh = xb.wait_read_frame()
print "don't wait here there is a time out"

我正在获取输出

working till now

代码无限等待

请帮忙

我在 "SH" 命令中也遇到了这个问题。经过大量调试并几乎拆开 Python-Xbee 库后,我终于找到了解决方案! 将"escaped=True"添加到构造函数中:

xb = Zigbee(s, escaped=True)

SH(高地址)响应似乎包含需要转义的字节。还要检查您的 API 模式是否匹配。