There is a bit missing from your Blocks, and this is wrong, similar to the way it was wrong before:
Let's dissect the error so you understand:
-
The Block 'set ListPicker Selection'. With this Block, the developer can programatically select an item in the List - it is then moved to become the first item in the List. This is intended for use with static lists, for example a list of different types of fruit or different types of cars. It's simply not appropriate for your App because until available devices have been scanned, you do not know what is in the list or where any particular device may be in the list.
-
On top of that, your Blocks attempt to change the selection with the value output by 'call Bluetooth Client Connect' - which is meaningless from the perspective of the list, as it is a 1 or 0 (True or False boolean).
-
Immediately after attempting to connect, the code will start Clock1 if the Bluetooth Client is connected - that leaves your connection down to luck alone because the test is too soon and if the test finds that the Bluetooth Client is not connected, the program stops working right there! So do you see:
You do have connection problems.
Unfortunately you have repeated the same mistake as before, when you could copy my code to get it right. In my code there is a note "Allow some time to Connect" and the Blocks within a Clock Timer make five connection attempts - if the connection was not achieved, the User is Notified.
Note, if you want the ListPicker Button to confirm to the User what has been picked:
The code could not work without both of them.
- The 'input' variable is used to store the data (a string of text) that arrives, via Bluetooth, from the Arduino.
- The 'list' variable is used to store the converted data, which initially looks like this, a single continuous string (of text):
value1|value2|value3
The string is converted (split-up) into a List:
value1
value2
value3
.... discarding the value delimiters ("|") and making it easy to test that all of the expected data, consisting of three values, has been received. If the List failed the test, perhaps one or all of the values had failed to arrive, no harm is done - the App continues and processes the next data packet on arrival.
Another thing you have missed in my example, in addition to reminding the User that the Arduino must be switched on, the phone's Bluetooth must be switched on and late versions of Android may require Location switched on, is this:
If an error occurs (perhaps silently or not noticed), knowing what error and the source is very valuable.
It is a thing, but only when Software Serial is being used (instead of or in addition to Arduino's built-in Serial Comms). So you can remove the the Serial Connected() test. Sorry, that's my bad.
I haven't used the 'SimpleDHT' library, which appears to be automatically delivering the values as integers (bytes). The standard DHT.h library delivers the values as floats. So if, after correcting your Blocks and testing again, you do not receive values in the App, do not perform a value type conversion in Serial on the DHT output:
Serial.print(temperature);
Serial.print("|");
Serial.print(humidity);
Serial.print("|");
Serial.print(lvl, 4); //4 decimal places
Serial.println();
Make sure the Text Colour is not the same as the Back Colour in the Value Labels!