This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ble_write VS notifyClientOfValueForCharacteristic

Hi! I've never worked with bluetooth before. I am using a Blend micro arduino-based board to send to the computer some different values (for instance an array of 10 float numbers).

After reading the really simple Hello World RBL example, I thought the way to go is to use ble_write to send data. But I faced the problem of 20 bytes per message and I crashed on it.

Then, documenting a little bit about BLE, in this repo, the notifyClientOfValueForCharacteristic and not I think that ble_write is only too simple and I have to declare a Characteristic and use this new command but I'm a little bit worried about making again a bad decision.

Where can I find some documentation to understand correctly with some lines of code for the chin nRF8001 on Arduino the differences between the 2 functions?

  • There is a limit of 20 bytes per message so if your data block is longer you need to send multiple messages. When using a GATT Server which is the typical implementation that you need, you should use the Notify to send data to the peer. I think both ble_write and notifyClientOfValueForCharacteristic are actually identical. You would just need to adjust for the fact that the message size is 20 bytes and send only data that fits that.

Related