#include <LiquidCrystal_I2C.h> //ของ wokwi
#define I2C_ADDR 0x27 //ของ wokwi
#define LCD_COLUMNS 20 //ของ wokwi
#define LCD_LINES 4 //ของ wokwi
LiquidCrystal_I2C lcd(I2C_ADDR, LCD_COLUMNS, LCD_LINES); //ของ wokwi
// make some custom characters:
byte Tri[8] = {
0b10000,
0b11000,
0b11100,
0b11110,
0b11110,
0b11100,
0b11000,
0b10000
};
byte Tri2[8] = {
0b00001,
0b00011,
0b00111,
0b01111,
0b01111,
0b00111,
0b00011,
0b00001
};
byte Tri3[8] = {
0b00000,
0b00000,
0b00000,
0b00000,
0b00000,
0b00000,
0b00000,
0b00000
};
void setup()
{
// initialize LCD and set up the number of columns and rows:
lcd.begin(16, 2);
// create a new character
lcd.createChar(0, Tri);
lcd.createChar(1, Tri2);
lcd.createChar(2, Tri3);
// create a new character
lcd.clear();
// Print a message to the lcd.
lcd.print("Custom Character");
}
// Print All the custom characters
void loop()
{
if(Serial.available()){
delay(600);
lcd.clear();
lcd.write(Serial.read());
}
}