How to use Raspberry Pi scan bluetooth devices All In One
蓝牙
$ sudo pip3 install pybluez
#!/usr/bin/env python3
import bluetooth
def scan():
print("Scanning for bluetooth devices:")
devices = bluetooth.discover_devices(lookup_names = True, lookup_class = True)
number_of_devices = len(devices)
print(number_of_devices,"devices found")
for addr, name, device_class in devices:
print("\n")
print("Device:")
print("Device Name: %s" % (name))
print("Device MAC Address: %s" % (addr))
print("Device Class: %s" % (device_class))
print("\n")
return
https://forums.raspberrypi.com/viewtopic.php?t=329762
from bluetooth import *
print "performing inquiry..."
nearby_devices = discover_devices(lookup_names = True)
print "found %d devices" % len(nearby_devices)
for name, addr in nearby_devices:
print " %s - %s" % (addr, name)
https://stackoverflow.com/questions/21000680/how-to-find-visible-bluetooth-devices-in-python
http://www.robertprice.co.uk/robblog/2007/01/programming_bluetooth_using_python-shtml/
https://github.com/karulis/pybluez
http://karulis.github.io/pybluez/
https://github.com/EnableTech/raspberry-bluetooth-demo
demos