#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x3F for a 16 chars and 2 line display
int s,m,h;
void setup() {
Serial.begin(115200);
lcd.init();
lcd.clear();
lcd.backlight(); // Make sure backlight is on
// Print a message on both lines of the LCD.
}
void loop()
{
if(s>59)
{
s=0;
m++;
if(m>59)
{
m=0;h++;
if(h>23) h=0;
}
}
lcd.setCursor(10,1);//第一列10個
lcd.print(s/10);
lcd.setCursor(11,1);//第一列11個
lcd.print(s%10);
lcd.setCursor(7,1);//第一列7個
lcd.print(m/10);
lcd.setCursor(8,1);//第一列8個
lcd.print(m%10);
lcd.setCursor(4,1);//第一列4個
lcd.print(h/10);
lcd.setCursor(5,1);//第一列5個
lcd.print(h%10);
delay(1000);
s=s+1;
}