#include <LiquidCrystal.h>
// inisialisasi pin yang digunakan
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
// character pertama
byte Char1[8] = {
B00000,
B00001,
B00011,
B00011,
B00111,
B01111,
B01111,
B11111
};
// character kedua
byte Char2[8] = {
B00010,
B10010,
B11010,
B11010,
B11110,
B11110,
B11110,
B11111
};
// character ketiga
byte Char3[8] = {
B11111,
B11111,
B11100,
B11100,
B11100,
B11100,
B11100,
B11100
};
// character keempat
byte Char4[8] = {
B11111,
B11111,
B11111,
B10001,
B10001,
B10001,
B11111,
B11111
};
void setup() {
lcd.begin(16, 2);
lcd.createChar(1, Char1);
lcd.createChar(2, Char2);
lcd.createChar(3, Char3);
lcd.createChar(4, Char4);
lcd.clear();
}
void loop() {
lcd.setCursor(0, 0); // setcursor dititik 0,0
lcd.write(byte(1)); // tampilkan Char1
lcd.setCursor(1, 0); // setcursor dititik 1,0
lcd.write(byte(2)); // tampilkan Char2, dst
lcd.setCursor(0, 1);
lcd.write(byte(3));
lcd.setCursor(1, 1);
lcd.write(byte(4));
lcd.setCursor(3, 0);
lcd.print("Rumahku");
lcd.setCursor(3, 1);
lcd.print("Istanaku");
}