I'm trying to display the time using the Time library
void displayTime()
{
long lastUpdate = 0; // Force update
byte i;
byte key = 0xFF;
while (key!= CENTER_KEY) {
// Update temp
if( millis() > lastUpdate + 500) {
time_t curr_time = now();
int hours = hour(curr_time);
int minutes = minute(curr_time);
int seconds = second(curr_time);
char hours_temp[3];
char minutes_temp[3];
char seconds_temp[3];
itoa (hours, hours_temp, 10);
itoa (minutes, minutes_temp, 10);
itoa (seconds, seconds_temp, 10);
lcd.writeString(0, 2, hours_temp, MENU_NORMAL);
// lcd.writeString(30, 2, ":", MENU_NORMAL);
lcd.writeString(30, 2, minutes_temp, MENU_NORMAL);
// lcd.writeString(42, 2, ":", MENU_NORMAL);
lcd.writeString(55, 2, seconds_temp, MENU_NORMAL);
lastUpdate = millis();
}
key = checkKeypressed();
}
// waitfor_OKkey();
}
the problem is that there is no padding, so as soon as the seconds go past 59 it shows 19 (then 29, 39, etc...
how can i add padding?