You have this which does not match the example code or wiring.
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
When I tried to run your code it caused garbage. My LCD is wired per the example and when I changed your code to match it worked.
You have this which does not match the example code or wiring.
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
When I tried to run your code it caused garbage. My LCD is wired per the example and when I changed your code to match it worked.