#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Set the LCD address to 0x27 in PCF8574 by NXP and Set to 0x3F in PCF8574A by Ti
LiquidCrystal_I2C lcd(0x27, 20, 4);
byte customChar[] = {
  0x00,
  0x00,
  0x00,
  0x1F,
  0x1F,
  0x1F,
  0x1F,
  0x1F
};
byte customChar1[] = {
  0x00,
  0x00,
  0x00,
  0x01,
  0x03,
  0x07,
  0x0F,
  0x1F
};
byte customChar2[] = {
  0x1F,
  0x1F,
  0x1F,
  0x1F,
  0x1F,
  0x1F,
  0x1F,
  0x1F
};
// lcd.write(1);
unsigned long currentMillis;
//------- first timer stuff --------
const unsigned long onTime1 = 50;
const unsigned long offTime1 = 250;
unsigned long previousMillis1 = 0;
unsigned long interval1 = onTime1;
boolean triggerState1 = true;
//------- end first timer stuff --------
void setup() {
  lcd.init();
  lcd.init();
  lcd.backlight();
  lcd.createChar(1, customChar);
  lcd.createChar(2, customChar1);
  lcd.createChar(3, customChar2);
}
void loop() {
  currentMillis = millis();
  if ((unsigned long)(currentMillis - previousMillis1) >= interval1) {
    if (triggerState1) {
      interval1 = offTime1;
      //Serial.println("idle");
    } else {
      interval1 = onTime1;
      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.write(byte(2));
      lcd.setCursor(1, 0);
      lcd.write(byte(1));
      lcd.setCursor(1, 1);
      lcd.write(byte(3));
      lcd.setCursor(1, 2);
      lcd.write(byte(3));
      lcd.setCursor(1, 3);
      lcd.write(byte(3));
      delay(1000);
    }
    triggerState1 = !(triggerState1);
    previousMillis1 = currentMillis;
  }
}