Untitled

mail@pastecode.io avatar
unknown
python
3 days ago
432 B
1
Indexable
Never
import asyncio
import bleak
from bleak import BleakScanner, BleakClient

# Scan for nearby Bluetooth devices and print them on the screen
async def scan_devices():
    print("Scanning for Bluetooth devices...")
    devices = await BleakScanner.discover()
    for device in devices:
        print(f"Found device: {device.name} - {device.address}")
    await scan_devices()

if __name__ == "__main__":
    asyncio.run(scan_devices())
Leave a Comment