I'm transferring data from a Feather M0 by using:
ble.println(43#94#143);
I'm receiving that data in appinventor by using the "register for strings" and "when strings received" blocks.
Then I use the "split text at" block to get rid of the # symbol. The results I get are (as seen by the "do it" boxes below):
(43
94
143)
Because the first and third are not numbers, I get the error seen below. If I disable the first calculation that uses the results, the second, ie 94 works as it should but not the (43, or the 143).
When I look at the "stringValues", I get:
(43#94#143)
When I use "is a string...thing" on stringValues, false is returned.
It seemes it has something to do with the fact that the split block output is a list, but on the other hand, the input (stringValues) seems not to be a string.
I couldn't figure out how to do that. I don't send the data with () so I don't know where they come from. Shouldn't the strings received block create strings without ()? How do I get rid of them?
You are getting back a list - a list of 1. You therefore need to get the first item of the list, which is your string. Then you can split the string to get the three numbers - in a list. (my list brackets are square because I have ShowListsAsJson ticked in screen properties)
Yes, that's my problem. The code given by TIMAI2 does indeed work. But when I insert the real data from the StringsReceived block using stringValues, it adds in the () as if stringValues is not text and therefore no longer works.
Here's my code in the form of TIMAI2 :