មេរៀនទី២២៖ LCD 16x2 Display Automatic Scroll Text

LCD 16x2 Display Automatic Scroll

 

1. Objective

The objective is talk about, display LCD 16x2 text with automatic scroll.


2. Requirement

  • Arduino Uno x1
  • LCD 16x2 x1 (Name in Proteus: LM016L)
  • Potentiometer 4.7Kohm or 10Kohm x1 (Name in Proteus: POT-HG)
  • USB Cable x1(No need in simulation)
  • Breadboard x1 (No need in simulation)
  • Electronic Wire (No need in simulation)

 

3. Build Circuit

Build circuit like Figure 1.

Figure 1. Arduino Connection


 

4. Coding

// Tann Thona 
// include the library code:
#include <LiquidCrystal.h>

const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

char Array[16] = {'H', 'E', 'L', 'L', 'O', ' ', 'W', 'O', 'R', 'l', 'D', ' ', '2', '0', ' ', ' '};

void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
lcd.setCursor(4,0);
lcd.print("Welcome");

}

void loop() {
// Turn off the display:
lcd.setCursor(0,1);
for(int i = 0; i<=15; i++)
{
lcd.print(Array[i]);
}
delay(70);

lcd.setCursor(0, 1);
char swap = Array[0];
for(int j=0; j<15; j++)
{
Array[j] = Array[j+1];
}
Array[15] = swap;
}

Click Here to Download Code and Proteus Simulation File 

 

4. Result

According to code above, on column 1 (top) is display "Welcome" and column 2 (under) is display "HELLO WORLD  20  " with automatic scroll.

Watch Video Explain in Khmer




YouTube: ICT4D-KH
Copyright By Tann Thona

Post a Comment

0 Comments