WHCSRL 技术网

python 接受连接蓝牙

import asyncio
from bleak import BleakClient

# address = "24:71:89:cc:09:05"
address = "54:6C:0E:53:35:F1"
MODEL_NBR_UUID = "00002a24-0000-1000-8000-00805f9b34fb"
# MODEL_NBR_UUID ='F000XXXX-0451-4000-B000-000000000000'

async def main(address):
    async with BleakClient(address) as client:
        model_number = await client.read_gatt_char(MODEL_NBR_UUID)
        print("Model Number: {0}".format("".join(map(chr, model_number))))

asyncio.run(main(address))
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
推荐阅读