Python Raspberry Pi Xbee串行。串行超时不工作
我正在尝试连接Rasberry Pi和UART头ttyAMA0上的Xbee 两者都已连接,我得到了+++->OK的响应 Xbee在模式2 API上Python Raspberry Pi Xbee串行。串行超时不工作,python,serial-port,raspberry-pi,infinite-loop,pyserial,Python,Serial Port,Raspberry Pi,Infinite Loop,Pyserial,我正在尝试连接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
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"
我得到了输出
工作到现在
代码会无限等待
请帮助我在命令“SH”时也遇到了这个问题。经过大量的调试和对PythonXBee库的分解,我最终找到了解决方案! 将“escape=True”添加到构造函数: xb=Zigbee(s,转义=True)
SH(高地址)响应似乎包含需要转义的字节。同时检查API模式是否匹配。重置Xbee后,它会正常工作,但每次重新启动时都会停止工作。。意味着我需要在每次重新启动后手动重置Xbee