Belajar Arduino - Scrolling Text Single Line LCD 1602 Arduino

 Belajar Arduino - Scrolling Text Single Line LCD 1602 Arduino



Wiring Diagram


Download Proteus Project

Klik nang Kene Gannn




Source Code 

Masukan Sorce Code Berikut :

#include <LiquidCrystal.h>
//inisialisasi PIN LCD
LiquidCrystal lcd(13, 12, 4, 5, 6, 7);//pin LCD
int i = 0;
void setup() {
  lcd.begin(16, 2);// set lcd pada saat sistem dimulai
  lcd.print("Scroll Atas Tok");
  delay(2000);
}
void loop()
{
  for (int i = 16; i > 4; i--) //Variabel i=panjang LCD "16" jika i lebih dari 4 maka kurangi panjang "16"
  {
    //running teks mulai
    lcd.setCursor(i, 0);
    lcd.print("Lukman Amirul F (170491100012)"); //setup awal runnng teks
    lcd.setCursor(0, 1);
    lcd.print("Nilai Sensor : ");
    delay(200);
    lcd.clear();
  }
  //jika teks berjalan dan sudah sampai pada baris ke 4 lcd
  lcd.setCursor(0, 1);
  lcd.print("Nilai Sensor : ");
  lcd.setCursor(4, 0); // set baris ke 4 LCD
  lcd.print("Lukman Amirul F (170491100012)");// tampilkan pada baris ke empat (POSISI TENGAH TEKS PADA LCD)
  delay (200);
  lcd.clear();
  {
    for (int i = 3; i >= 0; i--) // Jika posisi teks sudah pada posisi baris 0, maka tampilkan kembali teks dan lakukan pengurangan karaker
    {
      lcd.setCursor(0, 1);
      lcd.print("Nilai Sensor : ");
      lcd.setCursor(i, 0);
      lcd.print("Lukman Amirul F (170491100012)");
      delay(200);
      lcd.clear();
    }

    //pengurangan karakter
    lcd.setCursor(0, 0);
    lcd.print("ukman Amirul F (170491100012)");
    lcd.setCursor(0, 1);
    lcd.print("Nilai Sensor : ");
    delay(200);
    lcd.clear();
    //pengurangan karakter teks jika pada posisi 1
    lcd.setCursor(0, 0);
    lcd.print("kman Amirul F (170491100012)");
    lcd.setCursor(0, 1);
    lcd.print("Nilai Sensor : ");
    delay(200);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("man Amirul F (170491100012)");
    lcd.setCursor(0, 1);
    lcd.print("Nilai Sensor : ");
    delay(200);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("an Amirul F (170491100012)");
    lcd.setCursor(0, 1);
    lcd.print("Nilai Sensor : ");
    delay(200);

    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("n Amirul F (170491100012)");
    lcd.setCursor(0, 1);
    lcd.print("Nilai Sensor : ");
    delay(200);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print(" Amirul F (170491100012)");
    lcd.setCursor(0, 1);
    lcd.print("Nilai Sensor : ");
    delay(200);
    lcd.clear();

    lcd.setCursor(0, 0);
    lcd.print("Amirul F (170491100012)");
    lcd.setCursor(0, 1);
    lcd.print("Nilai Sensor : ");
delay(200);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("mirul F (170491100012)");
    lcd.setCursor(0, 1);
    lcd.print("Nilai Sensor : ");
    delay(200);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("irul F (170491100012)");
    lcd.setCursor(0, 1);
    lcd.print("Nilai Sensor : ");
    delay(200);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("rul F (170491100012)");
    lcd.setCursor(0, 1);
    lcd.print("Nilai Sensor : ");
    delay(200);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("ul F (170491100012)");
    lcd.setCursor(0, 1);
    lcd.print("Nilai Sensor : ");
    delay(200);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("l F (170491100012)");
    lcd.setCursor(0, 1);
    lcd.print("Nilai Sensor : ");
    delay(200);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print(" F (170491100012)");
    lcd.setCursor(0, 1);
    lcd.print("Nilai Sensor : ");
    delay(200);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("F (170491100012)");
    lcd.setCursor(0, 1);
    lcd.print("Nilai Sensor : ");
    delay(200);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print(" (170491100012)");
    lcd.setCursor(0, 1);
    lcd.print("Nilai Sensor : ");
    delay(200);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("(170491100012)");
    lcd.setCursor(0, 1);
    lcd.print("Nilai Sensor : ");
    delay(200);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("170491100012)");
    lcd.setCursor(0, 1);
    lcd.print("Nilai Sensor : ");
    delay(200);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("70491100012)");
    lcd.setCursor(0, 1);
    lcd.print("Nilai Sensor : ");
    delay(200);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("0491100012)");
    lcd.setCursor(0, 1);
    lcd.print("Nilai Sensor : ");
    delay(200);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("491100012)");
    lcd.setCursor(0, 1);
    lcd.print("Nilai Sensor : ");
    delay(200);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("91100012)");
    lcd.setCursor(0, 1);
    lcd.print("Nilai Sensor : ");
    delay(200);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("1100012)");
    lcd.setCursor(0, 1);
    lcd.print("Nilai Sensor : ");
    delay(200);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("100012)");
    lcd.setCursor(0, 1);
    lcd.print("Nilai Sensor : ");
    delay(200);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("00012)");
    lcd.setCursor(0, 1);
    lcd.print("Nilai Sensor :");
    delay(200);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("0012)");
    lcd.setCursor(0, 1);
    lcd.print("Nilai Sensor : ");
    delay(200);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("012)");
    lcd.setCursor(0, 1);
    lcd.print("Nilai Sensor : ");
    delay(200);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("12)");
    lcd.setCursor(0, 1);
    lcd.print("Nilai Sensor : ");
    delay(200);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("2)");
    lcd.setCursor(0, 1);
    lcd.print("Nilai Sensor : ");
    delay(200);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print(")");
    lcd.setCursor(0, 1);
    lcd.print("Nilai Sensor : ");
    delay(200);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print(" ");
    lcd.setCursor(0, 1);
    lcd.print("Nilai Sensor : ");
    delay(200);
    lcd.clear();
    //Akhir pengurangan karakter
    //tampilkan Blank pada LCD
    lcd.setCursor(0, 1);
    lcd.print("Nilai Sensor : ");
    delay(200);
    lcd.clear();
  }
}




Lebih Jelasnya Lihat Video Berikut

Komentar

Postingan populer dari blog ini

HMI WEINTEK Connect Arduino Menggunakan protokol Modbus RTU

Mengirim Data Sensor dari NodeMcu ESP8266 ke Spreeadshets atau Google Sheets