Setting bluetooth characteristic in new firmware
-
Hello!
I'm trying to use Wipy as a BLE sensor. The following code is working on firmware 1.18.2.r7. I'm using the nRF Connect and with notifications enabled, characteristic changes are updated.
But with newer firmware it crashes on chr1.value(i) with "OSError: Erorr while sending BLE indication/notification".from network import Bluetooth import time bt = Bluetooth() bt.set_advertisement(name='test-sensor', service_uuid=b'1234567890123456') bt.advertise(True) srv1 = bt.service(uuid=0x3000, isprimary=True, nbr_chars=1) chr1 = srv1.characteristic(uuid=0x3001, properties=Bluetooth.PROP_READ | Bluetooth.PROP_NOTIFY, value=0) i = 1 while i < 10: chr1.value(i) print('characteristic value = '+str(i)) time.sleep(5) i+=1 -
@lmo not sure I ever played with the BLE stuff on the Pycom modules, but shouldn’t you need to wait for a connection before sending updates? Though it would seem legitimate for it to just cache the value and don’t send anything if there’s no connection.
Does it throw on the first call, or after a few updates?
-
Thanks @jcaron, that was it. It would be nice if the characteristic could be set even if no client is connected, but I can probably work around that.
-
-
This post is deleted! -
I also have this problem... I tried with another similar code, but the same error "OSError: Erorr while sending BLE indication/notification" is displayed on chr1.value(val).
Anyone got a fix?
-
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login