Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/320.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Raspberry Pi Xbee串行。串行超时不工作_Python_Serial Port_Raspberry Pi_Infinite Loop_Pyserial - Fatal编程技术网

Python Raspberry Pi Xbee串行。串行超时不工作

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

我正在尝试连接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"
我得到了输出

工作到现在

代码会无限等待


请帮助

我在命令“SH”时也遇到了这个问题。经过大量的调试和对PythonXBee库的分解,我最终找到了解决方案! 将“escape=True”添加到构造函数:

xb=Zigbee(s,转义=True)


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

重置Xbee后,它会正常工作,但每次重新启动时都会停止工作。。意味着我需要在每次重新启动后手动重置Xbee