#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,4);
int S = 8; // count seconds
int M = 11; // count minutes
void setup()
{
lcd.init();
lcd.backlight();
lcd.setCursor(0,0);
lcd.print("HELLO WORLD");
delay(2000);
lcd.clear();
}
void loop()
{
S--;
delay(1000);
if(S<0)
{
M--;
S=59;
}
if(M<0)
{
while(1);
}
if (S < 10 && M >= 10)
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print(String(M) + ":" + "0" + String(S));
}
if (M < 10 && S >= 10)
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("0" + String(M) + ":" + String(S));
}
if (M < 10 && S < 10)
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("0" + String(M) + ":" + "0" + String(S));
}
}