16x2 LCD characters problem

Hello,

I finally managed to get the LCD working, I'm showing the time/date from an RTC module, temp from a thermistor ... but...
I made the program so when I press a button it would take a picture (i have an IR LED that send commands to a camera) and on the display it shows: Picture taken Date/Time
Here is where the fun begins. After releasing the button, I get back to the time/date/temp screen but I have leftover characters from the "Picture taken Date/Time" screen.
My question is how do I delete those leftovers ?
I tried lcd.clear() but the screen just flickers so fast that it looks like it's blank... I tried writing blank spaces, and again, same problem.

Thank you.

My question is how do I delete those leftovers ?
I tried lcd.clear() but the screen just flickers so fast that it looks like it's blank... I tried writing blank spaces, and again, same problem.

Either of those methods, properly called/implemented, should have worked. That they didn't implies that they were not called/written correctly. We'd need to see some code, though, to know for certain.

Below, I attached the full code that currently runs on the arduino.
It is far from being complete but if I can't solve the problem with the chars I won't go further.
The actual problem I guess is within the void loop()

#include <Time.h>  
#include <Wire.h>  
#include <DS1307RTC.h> 
#include <math.h>
#include <LiquidCrystal.h>
#define ThermistorPIN 0            
LiquidCrystal lcd(13, 12, 11, 10, 9, 8);
#define bLightPIN 7
float vcc = 4.93;
float pad = 9850;
float thermr = 10000;
float Thermistor(int RawADC) {
  long Resistance;  
  float Temp;
  Resistance=((1024 * thermr / RawADC) - pad); 
  Temp = log(Resistance);
  Temp = 1 / (0.001129148 + (0.000234125 * Temp) + (0.0000000876741 * Temp * Temp * Temp));
  Temp = Temp - 273.15;
  return Temp;
}
int pinIRLED = 5;                                 
int Buton = 2;                                         
char* luna[12]={"Ian","Feb","Mar","Apr","Mai","Iun","Iul","Aug","Sept","Oct","Nov","Dec"};
// sets the pulse of the IR signal.
void pulseON(int pulseTime) {
  unsigned long endPulse = micros() + pulseTime;        
  while( micros() < endPulse) {
    digitalWrite(pinIRLED, HIGH);                       
    delayMicroseconds(13);                              
    digitalWrite(pinIRLED, LOW);                        
    delayMicroseconds(13);                              
  }
}
void pulseOFF(unsigned long startDelay) {
  unsigned long endDelay = micros() + startDelay;       
  while(micros() < endDelay);
}
void takePicture() {
  for (int i=0; i < 2; i++) {
    pulseON(2000);                                      
    pulseOFF(27850);                                    
    pulseON(390);                                       
    pulseOFF(1580);                                     
    pulseON(410);                                       
    pulseOFF(3580);                                     
    pulseON(400);
    pulseOFF(63200);                                    
  }                                                   
}

void setup() 
{
  setSyncProvider(RTC.get);   
  lcd.begin(16, 2);
  lcd.clear();
  static unsigned char deg[8]={0xe, 0xa, 0xe, 0, 0x0, 0, 0, 0};
  lcd.createChar(0, deg);
  pinMode(7, OUTPUT);
  pinMode(pinIRLED, OUTPUT);                            
  pinMode(Buton, OUTPUT);                                

}

void loop() 
{
if(digitalRead(Buton) == HIGH)
{ 
  takePicture();                                      
  lcd.setCursor(0,0);
  lcd.print("Image captured at:");
  lcd.setCursor(0,1);
  lcd.print(day());
  lcd.print("-");
  lcd.print(luna[month()-1]);
  lcd.print("-");
  lcd.print(year());
  lcd.print(" ");
  lcd.print(hour());
  lcd.print(":");
  lcd.print(minute());

}
else
{ 
  float temp;
  temp=Thermistor(analogRead(ThermistorPIN));                        
  delay(500);
  lcd.setCursor(8,0);
  lcd.print("T:");
  lcd.print(temp,1);
  lcd.print((char)0);
  lcd.print("C");
  
  digitalWrite(bLightPIN, HIGH);
  
  lcd.setCursor(0,0);
  lcd.print(hour());
  lcd.print(":");
  lcd.print(minute());
  lcd.print(":");
  lcd.print(second());
  lcd.setCursor(3,1);
  lcd.print(day());
  lcd.print("-");
  lcd.print(luna[month()-1]);
  lcd.print("-");
  lcd.print(year());
}
}

This code still leaves the extra characters on the end of display, right?

I don't see any calls to lcd.clear() or any attempt the write over any data that might currently be displayed.

I tried to do like this:

void loop() 
{
if(digitalRead(Buton) == HIGH)
{ lcd.clear();
  takePicture();                                      
  lcd.setCursor(0,0);
  lcd.print("Image captured at:");
  lcd.setCursor(0,1);
  lcd.print(day());
  lcd.print("-");
  lcd.print(luna[month()-1]);
  lcd.print("-");
  lcd.print(year());
  lcd.print(" ");
  lcd.print(hour());
  lcd.print(":");
  lcd.print(minute());

}
else
{ lcd.clear();
  float temp;
  temp=Thermistor(analogRead(ThermistorPIN));                        
  delay(500);
  lcd.setCursor(8,0);
  lcd.print("T:");
  lcd.print(temp,1);
  lcd.print((char)0);
  lcd.print("C");
  
  digitalWrite(bLightPIN, HIGH);
  
  lcd.setCursor(0,0);
  lcd.print(hour());
  lcd.print(":");
  lcd.print(minute());
  lcd.print(":");
  lcd.print(second());
  lcd.setCursor(3,1);
  lcd.print(day());
  lcd.print("-");
  lcd.print(luna[month()-1]);
  lcd.print("-");
  lcd.print(year());
}

But all I've done is flicker the LCD so fast that it looks like it's blank...
How should i've called this function in order for the chars that were left to magically get deleted ?

A cheap way to solve your problem is to print out a few extra spaces after your meaningful output to erase the junks.

LCD.print(meaningful_number);
LCD.print(" "); // To erase junk;

Well, that did the trick!!! It took me a little to understand what you actually meant... But I did it, I got rid of the extra chars that were left.

Thank you verry much!

Or, you call lcd.clear() right before you write a new batch of data to it, not before the delay() or the takePicture() call.