Processing serial.available issue

That works perfectly, I didn’t realize that when I check the serial data availability, it’s because there is data coming from the sensor, so the delay function is not needed indeed. For best coding purposes it is better to move all the processing of the data inside the conditional statement, like you said, but I can leave it outside and set uncomment the val = null, and still works, but it is an unnecesary check of a conditional statement, so, I’ll go your way. Thank you!!

A question, why do you wrote if it is > 0 the right check here? When is equal to zero, is because there is no data coming, afaik.