Untitled

mail@pastecode.io avatar
unknown
python
14 days ago
453 B
1
Indexable
Never
import asyncio
from bleak import BleakScanner

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

# Main function to run the scanning
async def main():
    print("Scanning for Bluetooth devices...")
    await scan_devices()

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