Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有以下 Python 代码:
import bluetooth print(bluetooth.discover_devices())
这总是等待几秒钟并打印出一个空列表。
我的蓝牙适配器似乎正在工作,因为我可以bluetoothctl通过键入轻松发现设备scan on。
bluetoothctl
scan on
我该如何解决/解决这个问题?
尝试使用: print(bluetooth.discover_devices(duration=8, lookup_names=True, flush_cache=True, lookup_class=False)) 正如这个例子所暗示的
print(bluetooth.discover_devices(duration=8, lookup_names=True, flush_cache=True, lookup_class=False))
看起来 PyBlueZ 不支持 BLE,但您可以尝试使用其他库,如bluepy或pygatt。
我目前正在使用bluepy。从文档开始有点困难,但最后,它工作得很好。