instead of 9, it printed 90
No, it didn't: it printed “9”. However, it did not erase the previous
value before printing “9”. Before printing the 9, the LCD had:
│time left │
When you printed “9”, that character replaced the “1”, and you end up
The fix, as pointed ...
The object called lcd that you create inside the setup function is a local variable. It only lives as long as that function is executing - so not very long. It doesn't exist outside that function.
The lcd object you have in namespace display on the other hand is a global variable. That one lives as long as your program, which means until you reset your ...