/*
The circuit:
* LCD RS pin to digital pin 11
* LCD Enable pin to digital pin 10
* LCD D4 pin to digital pin 3
* LCD D5 pin to digital pin 2
* LCD D6 pin to digital pin 1
* LCD D7 pin to digital pin 0
* LCD R/W pin to ground
* LCD VSS pin to ground
* LCD VCC pin to 5V
* 10K resistor:
* ends to +5V and ground
* wiper to LCD VO pin (pin 3)
*/
// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(11, 10, 3, 2, 1, 0);
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("hh:mm:ss");
}
char * T(unsigned long t){
static char str[12];
long h = t / 3600;
t = t % 3600;
int m = t / 60;
int s = t % 60;
sprintf(str, "%02ld:%02d:%02d", h, m, s);
return str;
}
void loop() {
char *s;
s = T(millis()/1000);
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
// print the number of seconds since reset:
lcd.print(s);
delay(456);
}