BLE registerForNotify not working (with workaround) #628
I'm using v0.4.16 of the ESP32 BLE Arduino Library.
I have created a BLE client on a second ESP32 board based on the BLE_client example, to connect to the server, register for notifications and output the value (on LEDs). This connects to the server and reads the initial value correctly. However this line does not work:
If I do the following, everything works fine:
The following code does not work either:
Is 'registerForNotify()' supposed to work when called without also writing to the descriptor manually?
If I first connect with the nRF Connect app, register for notifications, disconnect and reboot the client board, 'registerForNotify()' on its own works fine and receives the notifications. Simply connecting and disconnecting in nRF Connect didn't make it work, I had to register for the notifications.
I think there is something wrong with the server side of things, because I built a seperate project last week to display the output from a Speed/Cadence sensor, and only used 'registerForNotify()', and it works great.
I've attached the server code as a text file - can't upload an ino file.
The text was updated successfully, but these errors were encountered:
This register for notifications only on local esp32 device only:
On arduino you still need this workaround. Its been added to this repository, but no new arduino version has been generated for some time and changes are not included yet.
Unfortunatly the workaround isn't working on my device...
I'm doing a manual reading of the characteristic to make sure measurement is working:
which results in this output:
all fine here.
now i try to activate notification (with workaround)
apparently (according to debug message) there is one last
Notification work fine with nRF-Connect.
@EBZ-Krisemendt I have one question, because logs shows that notification is received, are you trying to read characteristic value from within notificationCallback? If yes then it wont work, because for some reason (im guessing its some issue with semaphores) any action (read/write) called from notification callback is blocking whole app. You need to set some bool variable when you receive notification and in loop if variable is true then read characteristic.