I am scanning for BLE devices then listing the results on screen. I can list the Device Names without a problem, and the Device IDs without a problem, but I would like to show both of these together on each line of the list. I have tried various approaches including join text (see below failure), but no luck so far. Any suggestions appreciated!
As a matter of point, âtext itemsâ implies more than one item. The list viewer is a tool to see and select different entries from a LIST, so I assume that you may need to assign a LIST, which could be two individual text strings, as opposed to a string.
So, you do not join the two text; you assign each text component âDevice Idsâ and âDevice Namesâ to a âcreate a listâ block, which then is assigned to the list viewer.
Thanks. I saw this image in the list viewer docs:
But I can not find the âCreate a listâ block in ThunkableX. I tried the simple List block:
I put Device IDs as the first line and Device Names as the second, but that just resulted in all the Device IDs squeezed onto the first line of the listviewer and all of the Device Names squeezed onto the second line.
So I am still stumped.
I see. You want name#1 to be besides id#1, and name#2 besides id#2, etc.
That will take some doing.
You will have to parse both lists (names and ids), grabbing each element of both list in parallel and associate them in a resulting combined list. There is no free lunch, the logic you want will not happen just because you need it, you will have to code it.
An alternative would be to have two listview, side by side, with the first one on the left having the name, and the right one on the right the id. The issue would be that those, if they need to scroll, would not do so synchronously.
Having a composite list, with both the name and id, would mean that selection would pick up an element that is neither a device name nor a device id, and would need to be split to return something that could be used.
OK, that makes sense. I will give it a shot. Shouldnât be too difficultâŚ
Thanks!
Hi @zimbu-bcb,
@CBVG has been giving you excellent advice! Iâm just letting you know that the âlistâ block you refer to is exactly the same as the âcreate list withâ block - we just renamed it.
Thanks for jumping in, Jane. Thatâs what I assumed; I have some experience with MIT AI2 where the support docs are sometimes âa little bitâ out of sync with reality.
Iâm just testing out whether the ThunkableX platform is ready to handle BLE apps yet or not. From my experiments yesterday, it seems to not be quite there yet. I was hoping to build an app to configure beacons, so I definitely need a âBLE When Strings Receivedâ block, a disconnect BLE block, and some ability to include both Service UUIDs and Characteristic UUIDs.
But it seems pretty solid so far for communicating with Arduinos, so thatâs a nice step in the right direction. Hopefully the BLE coder at Thunkable X can keep up the hard work!
Thanks!
Can I ask you to check if you can get anything out of the list of BLE device names? I can only get a list of IDâs, but when I try to display names, there are only blank fields. Thanks.
Actually, it shows some names sometimesâŚ
How did you manage to show names. Also, how can I count the number of Bluetooth Devices in a list of .DeviceFound. I am able to display the list but cannot count the number of elements in it.
In the list blocks. There is this block
Have you tried it? Also, I suggest you check out this example
https://x.thunkable.com/copy/2b15204588729bb5cd9c94e1e511c279
Yes I tried the list option. It seems to scan all devices using .DeviceList but I cannot count the number of devices detected for some reason. I might use the Classic Bluetooth extension by Pura Vida to help.
Iâll check this out later today. Iâll add the feature and get back to you!
You are responding on a post where the last reply was 2 years ago.
sorry, i was it recently
Still⌠it helped me.