This may be helpful to some getting started with BluetoothLE. I don’t claim this to be all my own work I took an example from Indestructibles ( Here ) and with assistance from Forum members and that chap on the other end of Copilot, I ended up with this.
I started wondering how to get over the 23 character limit of BLE and then discovering the reason for the 23 character limit and GATT. The example demonstrates the use of 3 characteristic UUIDs for separate data sets and putting the results into separate lists. I suppose you could take it to the extreme and each variable to be sent from the server has its own discrete UUID.
I also had issues with the Bluetooth connection gracefully recovering from disconnections, whether intentional or not. For example, when the client dropped off the server had no idea so did not restart advertising so the client could not reconnect. This example demonstrates the client sending a ‘keep alive” message back to the server so the server knows when it needs to re-start advertising for the client to reconnect.
The client reconnects automatically knowing the server name, however, the original blocks are included to enable a connection to be made by selecting from a list. It should just be a case of enabling the blocks, making the “List_Connect” button visible in Designer. But a bit of work may be necessary to disable or remove the automatic connection blocks.
BLE_example.aia (203.9 KB)
ESP32_BLE_Demo.ino (6.1 KB)