How to activate two different LEDs depending on data output

optimaK5:
val2[] stores between 1-10 values at a times

You use it in a loop, where the index may go up to 255. That means you need room for 256 elements in your array no matter whether you store data in an element or not.