python - 如何使用 python digi-xbee 库从本地 xbee 接收多个 ATCommand 响应数据包,用于“FN”(查找邻居)AT 命令
问题描述
这是适用于除“FN”之外的所有 AT 命令的代码:
from digi.xbee.devices import XBeeDevice
#Initialise a serial port for the local xbee
local_xbee = XBeeDevice("/dev/tty.usbserial-AH02D9Q4", 9600).
#Opens serial port for sending commands
local_xbee.open()
#Sets new timeout for sync command operation
local.set_sync_ops_timeout(10).
#Send "FN" AT command to local xbee to receive neighbour list
neighbour_xbee_list = local.get_parameter("FN")
print(neighbour_xbee_list)
local_xbee.close()
笔记:
上面的代码只返回一个邻居,而我在网络中有多个节点。
解决方案
我相信问题的关键不是如何使用 FN 命令,而是如何发现邻居。
为此,您可以使用此处描述的 start_discovery_process 函数。 http://xbplib.readthedocs.io/en/latest/user_doc/discovering_the_xbee_network.html#discovernetwork
推荐阅读
- r - 如何在R中的X轴上制作短线
- javascript - 图像加载功能后 clearRect 功能不起作用
- python - python中带有参数的自定义静态方法装饰器
- excel - 需要在 Sumproduct + Sumif 公式中再添加一个条件
- asp.net-mvc-5 - 更改 quill.js 语法检查器的当前语言
- c# - 将单例类重构为基本泛型类
- css - Css scale 使某些字体因缺少 glyhs/字符而奇怪地调整大小
- r - 将字符转换为日期并在绘图轴上以正确的顺序显示它们
- angular - 'Post' 类型的参数不能分配给'string | 类型的参数 象征'
- python - Python更改JSON文件而不更新整个文件