[SOLVED] ArrayIndexOutOfBoundsException: 1

This is code from a tutorial on youtube https://www.youtube.com/watch?v=YgjsWvFRpSE&feature=youtu.be that I’m using and in the tutorial it works fine. I think it should spit out two values because of the line: list = split(val, ‘,’); it should split the data according to the comma it reads.

My theory is that the serial monitor isn’t printing out values consistently. For example it should be:

29, 29
29, 29
30, 29

BUT maybe its printing out like:

29,29
29,
30, 29

which it might crash/freeze? I’m not sure honestly