#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
int segmentPins[]={22,23,24,25,26,27,28};
int angka[]={
B01100110, //4
B01111111, //8
B01001111, //3
B01001111, //3
};
byte customChar1[] = {
B10000,
B01001,
B00110,
B00000,
B00000,
B00000,
B11000,
B00100
};
byte customChar2[] = {
B00001,
B00010,
B00100,
B00100,
B01110,
B01010,
B11111,
B01110
};
byte customChar3[] = {
B00000,
B00000,
B00000,
B00000,
B00000,
B00000,
B00011,
B00100
};
byte customChar4[] = {
B01000,
B10000,
B10010,
B10101,
B10010,
B10000,
B01000,
B00110
};
byte customChar5[] = {
B00000,
B00000,
B00000,
B00000,
B00000,
B01110,
B10001,
B00000
};
byte customChar6[] = {
B00010,
B00001,
B10101,
B00001,
B10101,
B00001,
B00010,
B11100
};
void setup() {
lcd.init();
lcd.backlight();
lcd.home();
for(int i = 22;i<=28 ; i++){
pinMode(i, OUTPUT);
}
}
void loop() {
lcd.createChar(0, customChar3);
lcd.setCursor(0,0);
lcd.write(0);
lcd.createChar(1, customChar2); // Menggunakan indeks 1
lcd.setCursor(1,0);
lcd.write(1);
lcd.createChar(2, customChar1); // Menggunakan indeks 2
lcd.setCursor(2,0);
lcd.write(2);
lcd.createChar(3, customChar6); // Menggunakan indeks 3
lcd.setCursor(2,1);
lcd.write(3);
lcd.createChar(4, customChar5); // Menggunakan indeks 4
lcd.setCursor(1,1);
lcd.write(4);
lcd.createChar(5, customChar4); // Menggunakan indeks 5
lcd.setCursor(0,1);
lcd.write(5);
lcd.setCursor(4,0);
lcd.print("GILANG");
lcd.setCursor(4,1);
lcd.print("4833");
for(int i = 0 ; i<4 ; i++){
PORTA = angka[i];
delay(1000);
PORTA = B00000000;
delay(500);
};
}