Problem: List index too large

I have a issue with this code. Some times show the error of list index too large. I tried to solve changing the "number of bytes" to "-1", but it makes crash the app.

I'm using this app to read a DHT11 sensor from Arduino by bluetooth conecction. The delay in my Arduino script is of 500, So after a lot of testing I saw the better results (less errors windows) adjusting the clock of the app to 500.

The number of bytes to -1. And set DelimiterByte to 10.
In arduino code, send the last data using Serial.println ().
It works for everyone, so there's no way it doesn't work for you.

The time interval should be as long as is practical for the purpose of the App. I have seen Apps watering plants every one minute when obviously that is too frequent :grin:

So that's the first point - don't set the interval to 500 if it can be 5000. Secondly, the time interval in the App needs to be about 20% faster than the Arduino interval, to avoid buffer over-run, which is what you are currently experiencing.

Before setting your Labels with values, check the length of the List to see if you have the correct number of values.

1 Like

Thanks, that was the solution.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.