#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Inisialisasi LCD 16x2 I2C dengan alamat 0x27 (umum digunakan)
LiquidCrystal_I2C lcd(0x27, 16, 2);
// Lirik lagu dibagi per 2 baris untuk LCD 16x2
const char* lyrics[][2] = {
{"tak genggem", "tanganmu"},
{"tak elus", "pipimu"},
{"sumebyar", "jantungku"},
{"koyo mandek", "ora mlaku"},
{"tresnoku yo mung", "kowe ra ono liyane"},
{"mugo dhewe bahagia", "selawase"}
};
const int lyricCount = sizeof(lyrics) / sizeof(lyrics[0]);
// Delay per huruf (ms)
const int charDelay = 100;
// Delay setelah satu tampilan baris selesai (ms)
const int lineDelay = 2000;
void setup() {
lcd.init();
lcd.backlight();
}
void loop() {
for (int i = 0; i < lyricCount; i++) {
lcd.clear();
// Tampilkan baris pertama per huruf
lcd.setCursor(0, 0);
printTypingEffect(lyrics[i][0]);
// Tampilkan baris kedua per huruf
lcd.setCursor(0, 1);
printTypingEffect(lyrics[i][1]);
delay(lineDelay);
}
}
// Fungsi untuk menampilkan teks per huruf dengan delay
void printTypingEffect(const char* text) {
for (int i = 0; text[i] != '\0'; i++) {
lcd.print(text[i]);
delay(charDelay);
}
}