#include <LiquidCrystal_I2C.h>
#define LedBiru 12
LiquidCrystal_I2C lcd(0x27,16,2);
int segmentPIN[] = {22,23,24,25,26,27,28,29}; //a,b,c,d,e,f,g,dp
int jumlahPIN = 8;
char ultah[] = {B00000110,B00000111,B00111111,B01001111,B01011011,B01001111};
byte customChar1[8] = {
0b00000,
0b00000,
0b00000,
0b00100,
0b01110,
0b11111,
0b11111,
0b01111,
};
byte customChar2[8] = {
0b00000,
0b00000,
0b00000,
0b00100,
0b01110,
0b11111,
0b11111,
0b11110,
};
byte customChar3[8] = {
0b00111,
0b00011,
0b00001,
0b00000,
0b00000,
0b00000,
0b00000,
0b00000,
};
byte customChar4[8] = {
0b11100,
0b11000,
0b10000,
0b00000,
0b00000,
0b00000,
0b00000,
0b00000,
};
void setup() {
// put your setup code here, to run once:
for (int i=0; i < jumlahPIN; i++){
pinMode(segmentPIN[i], OUTPUT);
}
pinMode(LedBiru, OUTPUT);
lcd.init();
lcd.clear();
lcd.backlight();
lcd.createChar(0, customChar1);
lcd.createChar(1, customChar2);
lcd.createChar(2, customChar3);
lcd.createChar(3, customChar4);
lcd.setCursor(0,0);
lcd.write((byte)0);
lcd.setCursor(1,0);
lcd.write((byte)1);
lcd.setCursor(0,1);
lcd.write((byte)2);
lcd.setCursor(1,1);
lcd.write((byte)3);
for (int i=0; i<6; i++){
PORTA = ultah[i];
delay(500);
PORTA = B00000000;
delay(100);
}
for (int i=1; i<=1; i++){
lcd.setCursor(8,0);
lcd.print("3");
delay(400);
}
for (int i=1; i<=1; i++){
lcd.setCursor(8,0);
lcd.print("2");
delay(400);
}
for (int i=1; i<=1; i++){
lcd.setCursor(8,0);
lcd.print("1");
delay(400);
}
}
void loop(){
// put your main code here, to run repeatedly:
for (int i=1; i<=13; i++){
lcd.setCursor(2,0);
lcd.print("HAPPY BIRTHDAY");
lcd.setCursor(2,1);
lcd.print("FARNO HUSI");
delay(50);
}
for (int i=1; i<=13; i++){
lcd.scrollDisplayRight();
delay(200);
}
for (int i=1; i<=13; i++){
lcd.scrollDisplayLeft();
delay(200);
}
digitalWrite(LedBiru, HIGH);
delay(2000);
digitalWrite(LedBiru, LOW);
}