#include <LiquidCrystal.h>
// Inisialisasi LCD (RS, E, D4, D5, D6, D7)
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
lcd.begin(16, 2); // Menyiapkan LCD 16x2
lcd.print("Hello, World!"); // Menampilkan teks awal
}
void loop() {
// Blinking
for (int i = 0; i < 5; i++) {
lcd.clear(); // Menghapus layar
delay(500);
lcd.print("Hello, World!");
delay(500);
}
// Scrolling
lcd.clear();
for (int pos = 0; pos < 16; pos++) {
lcd.setCursor(pos, 0); // Mengatur posisi kursor
lcd.print("Scrolling... "); // Teks yang akan digulir
delay(300);
lcd.clear(); // Menghapus layar
}
// Running Text
lcd.clear();
for (int pos = 0; pos < 32; pos++) {
lcd.setCursor(0, 1); // Menampilkan teks pada baris kedua
lcd.print("Running Text! ");
lcd.print(" "); // Spasi untuk menghapus teks yang lama
lcd.scrollDisplayLeft(); // Menggeser teks ke kiri
delay(300);
}
}