//ເປັນໄລບາລີ່ສຳລັບຈັດການການສື່ສານແບບ I2C
#include <Wire.h>
//ເປັນໄລບາລີສຳລັບຄວບຄຸມການສະແດງຜົນຈໍ LCD
#include <LiquidCrystal_I2C.h>
//....(ທີ່ຢູ່, ຖັນ, ແຖວ);
LiquidCrystal_I2C lcd(0x27,16,2);
int day=3,month=7,year=2024;
int h=7,m=5,s=4;
void setup()
{
lcd.init(); //inti = initial
}
void loop()
{
lcd.setCursor(0,0); // (column,row);
lcd.print("DATE:");
if(day < 10)
{
lcd.print("0");
}
lcd.print(day);
lcd.print("/");
if(month < 10)
{
lcd.print("0");
}
lcd.print(month);
lcd.print("/");
lcd.print(year);
lcd.setCursor(0,1);
lcd.print("TIME:");
if(h < 10)
{
lcd.print("0");
}
lcd.print(h);
lcd.print(":");
if(m < 10)
{
lcd.print("0");
}
lcd.print(m);
lcd.print(":");
if(s < 10)
{
lcd.print("0");
}
lcd.print(s);
}