One way: Use lcd.setCursor() to go the part that you want to change. You can write spaces or whatever new data you want to show. Leave the rest of the display alone.
#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
void setup()
{
Serial.begin(9600);
lcd.begin(20, 2);
// This is fixed at the first column of the top row
lcd.print("Time = 0");
}
unsigned long secs; // Automatically initialized to zero
unsigned long old_time; // Automatically initialized to zero
void loop()
{
unsigned long now = millis();
if ((now - old_time) > 1000) {
++secs;
lcd.setCursor(7, 0); // Column 8 of first row
lcd.print(secs);
// Also show on serial monitor just for kicks
Serial.print("Time = ");
Serial.println(secs);
old_time = now;
}
}
Regards,
Dave