“Select list item: Attempt to get item number 2 of a list of length 1"

HI
I have been working on a project that is basically controlling a tens device through an app. When I used the app with it was working fine but as soon as I added the sensors (MAX30100, Accelerometer and temperature sensor) the app started to give an error that is [“Select list item: Attempt to get item number 2 of a list of length 1]. What should be done to remove this error? I have attached the pictures of my blocks.
Any help will be appreciated.



Dear @Tayyaba_Asif welcome to the Community,
it seems that the BT string that you receive does not split into three items.
The first thing that I can suggest is to show in a label the entire string received, so to debug what effectively your app receives.
Then you can see if the number of items (separated by ";") is what you expect.
Second hint is to change the way in which you receive the data.
Please consider the "number of bytes" like a "flag" that bytes are present in the receiving buffer rather than a real number of bytes, therefore you could use the receive text in the following way:
image
To comply with this method you shall modify your Arduino code ending the transmission with a BT.println(); so to send a Linefeed (ASCII LF / 10 decimal / 0x0A Hex) character that warns the AI2 app to consider ended the frame received.
At initialization level you should do like this:
image

then enable the Ck1_BT only after a successful connection (in my example with a period of 10 ms, but you can set according to your needs).
.
Hoping it can help !
Best wishes.