Bluetooth deactivates after some time



  • I want to send data from Puck.js to WiPy over Bluetooth and generally this works fine. But after some minutes, the Bluetooth of the WiPy seems to deactivate itself. Because neither the Puck.js nor my smartphone is finding the device anymore.

    Here's my code

    bluetooth = Bluetooth()
    bluetooth.set_advertisement(name='Terrarium_Base', service_uuid=uuid2bytes('0612038a-e6fa-42d2-9379-fbbf70a56e5c'))
    bluetooth.advertise(True)
    bluetooth.callback(trigger=Bluetooth.CLIENT_CONNECTED | Bluetooth.CLIENT_DISCONNECTED, handler=conn_cb)
    srv1 = bluetooth.service(uuid=uuid2bytes('0612038a-e6fa-42d2-9379-fbbf70a56e5c'), isprimary=True)
    chr1 = srv1.characteristic(uuid=uuid2bytes('0de36786-4bbc-49bc-9b3c-8f257e4f035c'), value=5)
    char1_cb = chr1.callback(trigger=Bluetooth.CHAR_WRITE_EVENT, handler=char1_cb)
    

    Am I missing something?



Pycom on Twitter