Untitled

Anonymous
Python
07/10/2024 2:06 AM
453 B
26
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())
Editor is loading...
Leave a Comment