Issue with Arduino Uno and 16x2 lcd

Oops, i'm sorry! I was tired and i forgot my sketch, but it's not the problem and nor os the led. The problem is: if arduino is connected with usb pc the display and all works as it have to work, but if i disconnect it from the pc and connect it with a 9V battery, the display go on loop.
Anyway here is the sketch.
Thanks

prova_2.ino (5.46 KB)