#include <LiquidCrystal_I2C.h>
#define I2C_ADDR 0x27
#define LCD_COLUMNS 20
#define LCD_LINES 4
byte customChar[] = { //ใ
B01100,
B11010,
B10110,
B01010,
B00010,
B00010,
B00011,
B00011
};
byte customChar2[] = { //ช้
B00000,
B01010,
B01100,
B00001,
B11010,
B11100,
B01010,
B01110
};
byte customChar3[] = {
B00000,
B00100,
B00110,
B11111,
B11111,
B00110,
B00100,
B00000
};
byte customChar4[] = {
B00001,
B11110,
B00010,
B01110,
B11010,
B11010,
B01110,
B00110
};
byte customChar5[] = {
B00000,
B00110,
B00110,
B10010,
B01010,
B00110,
B00000,
B00000
};
LiquidCrystal_I2C lcd(I2C_ADDR, LCD_COLUMNS, LCD_LINES);
int a1 = 0;
void setup() {
lcd.init();
lcd.backlight(); // เริ่มต้นการทำงาน lcd
lcd.createChar(0, customChar);
lcd.createChar(1, customChar2);
lcd.createChar(2, customChar3);
lcd.createChar(4, customChar4);
lcd.createChar(5, customChar5);
}
void loop() {
// lcd.setCursor(0,0);
// lcd.print("set-water[auto]");
lcd.setCursor(2,0);
//lcd.home();
lcd.write((byte)0);
lcd.setCursor(3,0);
//lcd.home();
lcd.write((byte)1);
// lcd.setCursor(8,0);
// lcd.print("max water");
lcd.setCursor(0,1);
lcd.print("[");
lcd.setCursor(5,1);
lcd.print("]");
lcd.setCursor(1,1);
lcd.print(a1);
delay(500);
lcd.setCursor(6,1);
//lcd.home();
lcd.write((byte)2);
lcd.setCursor(7,1);
lcd.print("[3000]");
lcd.setCursor(6,0);
//lcd.home();
lcd.write((byte)4);
lcd.setCursor(7,0);
lcd.write((byte)5);
a1++;
}