1
import asyncio
from bleak import BleakClient

# Replace with the address of your Arduino BLE Sense 33
device_address = "A3:5F:E3:F2:40:5B"  # Update with actual address of BLE Sense 33

# Replace with the UUID of the characteristic
CHARACTERISTIC_UUID = "23456789-2345-6789-2345-6789abcdef0"

async def run():
    print("Attempting to connect...")
    
    # Create BleakClient instance
    async with BleakClient(device_address) as client:
        if client.is_connected:
            print("Connected to the BLE Sense 33!")
        else:
            print("Failed to connect.")
            return

        # Read the characteristic (you can also write or perform other operations)
        try:
            value = await client.read_gatt_char(CHARACTERISTIC_UUID)
            print(f"Received value from characteristic: {value}")
        except Exception as e:
            print(f"Failed to read characteristic: {e}")

asyncio.run(run())

For immediate assistance, please email our customer support: [email protected]

Download RAW File