Keypad, RTC, 2x16 LCD and xbee

Dear All,

I had a Arduino Mega board connected to a 4x4 keypad a RTC, 2x16 LCD and a xbee. The LCD will display the current time and the program will still detect the keypad press. When '1' is pressed, a serial string will be send out from the xbee to control something.

I saw from the RTC sketch that to display the time, we will delay(1000); so that the time in the LCD will update every seconds. But by putting the delay(1000); my keypad pressed may not respond and nothing will be send out as the program may be in the delay function doing nothing. As I am using the keypad scanning method in the forum and the time display also in the forum, I had a problem with putting both together.

Can someone help me as to what should I do to get rid of the delay(1000) and yet can use the loop to scan keypad and still display the time on the LCD every seconds.

Thanks a lot

See Blink without Delay example in Arduino IDE. This is only cure to your problem.