My implementation is ESP32 S3 and Rd-03d/LD2450 radar head with the display to be on an Android tablet. However, before I get that far I need to be able to get the data from the ESP32 to AI2
At first, I was trying to get a CSV string sent over in chunks and then reassemble them in AI2, that was not working so I did consider changing the MTU but thought I had better try GATT as that is the way it should be
To simplify things the ESP is sending three CSV messages with their own characteristic UUIDs
These are being sent continuously and I have nRF Connect on the tablet confirming the transmission.
I have two problems, #1 reliably getting AI2 to connect and then #2 doing anything sensible with the data.
Once I get a connection, I can see the messages coming over (debug text boxes) but only if I disable the “if” statements in BluetoothLE1.StringsRecieved. It does not work even with only the “if-not- is list empty?- get stringValues” enabled.
The various connect/disconnect buttons and text boxes were to try to determine what worked and what didn’t connection wise.
You only need to register once, so disable the clock afterwards. You don't want the registrations piling up.
Don't apply text blocks to lists like stringvalues.
Either select item 1 or process it in a For Each Item in List loop. By the nature of the event, the list will never be an empty list (not to be confused with empty text.)
Thank you. I will try that. I think the original had the used an index list but I removed it in my hacking for an answer. When I process each stringvalue by an index list do I still need to strip the brackets prior?
I occurred to me overnight would my use of the Thunkables aia from the original post pose any problems? When I imported it the BLE extension was out of date. Does that mean all the other code, behind the imported blocks, is also out of date? Or at least Thunkables code rather than the latest AI2 version of the code?
Aside from connection blocks, everything else looks the same.
If you see brackets, you are confusing text-ified lists with lists (which can not be seen, only selected from and manipulated with list blocks in memory.)
The [ brackets are JSON notation, which is a common and informative text wrapper for lists and dictionaries, good for text file packaging, but requires decoding back to lists for active use.
The latest test version of the "StringsReceived". None of the Buffer_Listx get populated (Debug4 text) with the 3 methods being tried. Enabling/disabling the set stringValues block that strips the () makes a difference apart from the Debug2 text changing to with or without brackets.
The comparison of the characteristic UUID's failed for 2 reasons #1 because I was using a logic compare rather than a text compare and #2 despite the UUIDS being declared in uppercase in both the ESP32 and AI2 code they were being sent from the ESP32 in lower case. This meant that compare tests failed and none of the lists were being populated
As the string is received as ["The,quick"] striping off the [" "] allows "list from csv row - text" block to be used to populate the list.
Amongst other things the comms problem has been mainly solved or at least understood. The ESP32 code stops advertising once the connection is made. If the connection drops it needs a reset to get it to advertise again. Then the AI2 app can reconnect.