Skip to content

Instantly share code, notes, and snippets.

@yasudacloud
Created July 8, 2025 12:00
Show Gist options
  • Select an option

  • Save yasudacloud/9bf9ea3780f01817979bd146a7884b3e to your computer and use it in GitHub Desktop.

Select an option

Save yasudacloud/9bf9ea3780f01817979bd146a7884b3e to your computer and use it in GitHub Desktop.
write_char = "16860002-a5ae-9856-b6d3-dbb4c676993e"
notify_char = "16860003-a5ae-9856-b6d3-dbb4c676993e"
async with BleakClient(
device,
pair=True,
services=[service_uuid],
timeout=20
) as client:
ble_client = client
writer = client.services.get_characteristic(write_char)
notifier = client.services.get_characteristic(notify_char)
# Notify開始
await client.start_notify(notifier, notification_handler)
async def notification_handler(_, data: bytearray):
print(data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment