// -----------------------------------------------
// Cara menghidupkan LCD display (2X16)
// Oleh : Hendry Kurniawan,S.Pd
// -----------------------------------------------
#include <LiquidCrystal.h>
// nomor pin arduino uno yang terhubung ke LCD
const int PIN_RS = 12;
const int PIN_E = 11;
const int PIN_DB_4 = 7;
const int PIN_DB_5 = 6;
const int PIN_DB_6 = 5;
const int PIN_DB_7 = 4;
// Penentuan pin kontrol & pin data pada LCD
LiquidCrystal lcd(PIN_RS, PIN_E, PIN_DB_4, PIN_DB_5, PIN_DB_6, PIN_DB_7);
void setup()
{
// Tentukan ukuran LCD yaitu 2x16 (16 kolom dan 2 baris)
lcd.begin(16, 2);
lcd.clear(); //menghapus layar LCD
for(int i =16; i>=0; i--) {
if(i == 0){
lcd.clear();
lcd.setCursor(0,0);
lcd.print("SELAMAT DATANG");
lcd.setCursor(0, 1);
lcd.print("DI SMK N 2 SBY");
}
lcd.setCursor(i, 0); // Set posisi di kolom 0 baris ke-0
lcd.print("SELAMAT DATANG"); // teks ini bisa diganti
lcd.setCursor(i, 1);
lcd.print("DI SMK N 2 SBY");
delay(80);
}
}
void loop() {
lcd.clear();
delay(500); //tunda 2 detik
for(int j = 16; j >= 0;j--) {
if(j == 0) {
lcd.clear();
lcd.setCursor(0, 0); // Set posisi di kolom 4 baris ke-0
lcd.print("ALIF WAHYU"); // teks ini bisa diganti
lcd.setCursor(0, 1); // Set posisi di kolom 5 baris ke-1
lcd.print("XI TEI"); // teks ini bisa diganti
}
lcd.setCursor(j, 0);
lcd.print("ALIF WAHYU");
lcd.setCursor(j, 1);
lcd.print("XI TEI");
delay(80);
}
delay(1000); //tunda 2 detik
}