#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); // I2C address 0x27, 16 column and 2 rows
byte customChar0[8] = {
0b00000,
0b00000,
0b00000,
0b00001,
0b00011,
0b00111,
0b01111,
0b11111
};
byte customChar1[8] = {
0b11111,
0b01111,
0b00111,
0b00011,
0b00001,
0b00000,
0b00000,
0b00000
};
byte customChar2[8] = {
0b00000,
0b00000,
0b00000,
0b00000,
0b00000,
0b00000,
0b11111,
0b11111
};
byte customChar3[8] = {
0b11111,
0b11111,
0b00000,
0b00000,
0b00000,
0b00000,
0b00000,
0b00000
};
void setup(){
lcd.init(); // initialize the lcd
lcd.backlight();
}
void loop(){
// put your main code here, to run repeatedly:
lcd.createChar(0, customChar0); // create a new custom character (index 0)
lcd.setCursor(14, 0); // move cursor to (14, 0)
lcd.write((byte)0); // print the custom char 0 at (14, 0)
lcd.createChar(1, customChar1); // create a new custom character (index 01)
lcd.setCursor(14, 1); // move cursor to (14, 1)
lcd.write((byte)1); // print the custom char 1 at (14, 1)
lcd.createChar(2, customChar2); // create a new custom character (index 02)
lcd.setCursor(15, 0); // move cursor to (15, 0)
lcd.write((byte)2); // print the custom char 2 at (15, 0)
lcd.createChar(3, customChar3); // create a new custom character (index 03)
lcd.setCursor(15, 1); // move cursor to (15, 1)
lcd.write((byte)3); // print the custom char 3 at (15, 1)
lcd.scrollDisplayLeft();
delay(500);
}