void timeRefresh() { if (hour() > 9) { // Next "if, else" statements print the time LCD.setCursor(0,0); // in the right places on display LCD.print(hour()); // Ex: If the hour is less than 10, the } // display prints a " " in front of the number else { LCD.setCursor(0,0); LCD.print(" "); LCD.setCursor(1,0); LCD.print(hour()); } LCD.setCursor(2,0); LCD.print(":"); if (minute() > 9) { LCD.setCursor(3,0); LCD.print(minute()); } else { LCD.setCursor(3,0); LCD.print("0"); LCD.setCursor(4,0); LCD.print(minute()); } LCD.setCursor(5,0); LCD.print(":"); if (second() > 9) { LCD.setCursor(6,0); LCD.print(second()); } else{ LCD.setCursor(6,0); LCD.print("0"); LCD.setCursor(7,0); LCD.print(second()); } LCD.setCursor(12,0); // Next "if" statements print the abbreviation for if (weekday()==2) // the week day. Note: The cursor position on display { // is changed for "Thur" since there is one more letter LCD.setCursor(11,0); // to be printed. LCD.print(" "); LCD.print("Mon"); } if (weekday()==3) { LCD.setCursor(11,0); LCD.print(" "); LCD.print("Tue"); } if (weekday()==4) { LCD.setCursor(11,0); LCD.print(" "); LCD.print("Wed"); } if (weekday()==5) { LCD.setCursor(11,0); LCD.print("Thur"); } if (weekday()==6) { LCD.setCursor(11,0); LCD.print(" "); LCD.print("Fri"); } if (weekday()==7) { LCD.setCursor(11,0); LCD.print(" "); LCD.print("Sat"); } if (weekday()==1) { LCD.setCursor(11,0); LCD.print(" "); LCD.print("Sun"); } LCD.setCursor(10,1); // Next "if" statements print the correct month on the if (month()==1) // lower right of display. For June, July, and Sept, a { // space is added to the left for smoother "looks" LCD.setCursor(9,1); LCD.print(" "); LCD.print("Jan"); } if (month()==2) { LCD.setCursor(9,1); LCD.print(" "); LCD.print("Feb"); } if (month()==3) { LCD.setCursor(9,1); LCD.print(" "); LCD.print("Mar"); } if (month()==4) { LCD.setCursor(9,1); LCD.print(" "); LCD.print("Apr"); } if (month()==5) { LCD.setCursor(9,1); LCD.print(" "); LCD.print("May"); } if (month()==6) { LCD.setCursor(9,1); LCD.print("June"); } if (month()==7) { LCD.setCursor(9,1); LCD.print("July"); } if (month()==8) { LCD.setCursor(9,1); LCD.print(" "); LCD.print("Aug"); } if (month()==9) { LCD.setCursor(9,1); LCD.print("Sept"); } if (month()==10) { LCD.setCursor(9,1); LCD.print(" "); LCD.print("Oct"); } if (month()==11) { LCD.setCursor(9,1); LCD.print(" "); LCD.print("Nov"); } if (month()==12) { LCD.setCursor(9,1); LCD.print(" "); LCD.print("Dec"); } LCD.setCursor(14,1); // Next "if" statement prints the day of the if (day()>9) // month following the month name, skipping a { // space in between LCD.print(day()); } else { LCD.print("0"); LCD.setCursor(15,1); LCD.print(day()); } LCD.setCursor(8,0); LCD.print(" "); LCD.setCursor(0,1); LCD.print(" "); }