#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <string.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); // Alamat I2C bisa 0x27 atau 0x3F
// =======================
// LIRIK LAGU
// =======================
const char* lyrics[] = {
"Aman saja", "mo ngapain", "mo repot",
"Tunjugan", "sampe tua", "turun dari", "Freeport",
"Honeymoon", "di Inggris", "di Paris", "di Jerman",
"Su pasti ko", "deng sa barang", "jalan aman",
"Ko tolong", "bilang cinta ka", "tidak oh", "cinta ka tidak",
"Jang sampe", "dukun bertindak",
"Ko tinggal", "jawab mau ka", "tidak oh", "mau ka tidak",
"Jang sampe", "setan berpihak"
};
// Durasi setiap kata (ms)
const int delays[] = {
600, 600, 800,
600, 600, 600, 1000,
700, 700, 700, 2000,
1200, 1200, 900,
1200, 1200, 1200, 800,
1200, 900,
1200, 1200, 700, 700,
600, 900
};
// =======================
// PENGATURAN TAMBAHAN
// =======================
const int wordCount = sizeof(lyrics) / sizeof(lyrics[0]);
int typingDelay = 180; // efek ketik lebih cepat
// Promo teks di bawah baris terakhir
const char* promoPairs[] = {
"Musik by FEBRI TRIANTO", "🔥🔥🔥"
};
const int promoPairCount = sizeof(promoPairs) / sizeof(promoPairs[0]);
const int promoDisplayInterval = 2;
// =======================
// PROGRAM UTAMA
// =======================
void setup() {
lcd.init();
lcd.backlight();
lcd.clear();
Serial.begin(9600);
lcd.setCursor(0, 0);
lcd.print("Play: Aman Saja");
delay(1500);
lcd.clear();
}
void loop() {
for (int i = 0; i < wordCount; i++) {
int row = i % 2; // Ganti baris 0 dan 1 bergantian
// Bersihkan baris target
lcd.setCursor(0, row);
lcd.print(" "); // 16 spasi kosong
// Efek ketik (khusus baris terakhir)
if (i == wordCount - 1) {
const char* word = lyrics[i];
int len = strlen(word);
int totalSteps = promoPairCount * promoDisplayInterval;
if (totalSteps < len) totalSteps = len;
for (int j = 0; j <= totalSteps; j++) {
lcd.setCursor(0, row);
lcd.print(" ");
lcd.setCursor(0, row);
for (int k = 0; k < j && k < len; k++) {
lcd.print(word[k]);
}
int promoIndex = j / promoDisplayInterval;
if (promoIndex < promoPairCount) {
lcd.setCursor(0, 1);
lcd.print(" ");
lcd.setCursor(0, 1);
lcd.print(promoPairs[promoIndex]);
}
delay(typingDelay);
}
delay(delays[i]);
} else {
const char* word = lyrics[i];
int startPos = (16 - strlen(word)) / 2;
if (startPos < 0) startPos = 0;
lcd.setCursor(startPos, row);
lcd.print(word);
delay(delays[i]);
}
if (row == 1) {
delay(300);
lcd.clear();
}
}
lcd.clear();
lcd.setCursor(2, 0);
lcd.print("Selesai :)");
lcd.setCursor(0, 1);
lcd.print("Remix by FEBRI TRIANTO");
while (true); // Hentikan loop
}
HASIL JADI
UPLOAD DISINI
0 comments: