SCROLL DATA ON LCD 16×2 USING ARDUINO

Scroll data on LCD 16×2 using Arduino is a cool and attractive feature available for LCD screens. People generally notice and pay attention to Scrolling.

To scroll data on the LCD screen we must keep in mind the concept we used in setting up cursor position, for scrolling data from left to right we will change the column index from 0 (or even negative value) to 15 with row 0 or 1. We will use for loop to increase the index let check the code below:

NOTE: Most important thing in scrolling is deleting the previous data from the screen by using the clear() function. Syntax: object.clear(). Recommended: Try code with and without clear() function to find out the differences.

CIRCUIT DIAGRAM

circuit diagram - connection of lcd with arduino
Circuit Diagram – Connection of LCD 16×2 with Arduino

CONNECTION TABLE FOR LCD AND ARDUINO

S.N.Arduino PinLCD pin 
1.1. VSSGround (0V)
2.2. VCC+ 5V
3.3. VEE10K POT
4.24. RS
5.5. RWGround
6.36. E
7.7. D0-
8.8. D1-
9.9. D2-
10.10. D3-
11.411. D4
12.512. D5
13.613. D6
14.714. D7
15.15. Anode ++ 5V
16.16. Cathode -0V (Ground)

ARDUINO CODE FOR DATA SCROLLING ON LCD USING ARDUINO

// delay variable del with a value of 200 for 200 ms
#define del 200

#include<LiquidCrystal.h>
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
int  i = 0 , j = 0;
void setup( ) {
  lcd.begin(16, 2);
}

void loop( ) {
  //(1) Scrolling from Left to Right
  // Use 0 instead of -5 and check out the difference
  for (j = -5 ; j <= 16 ; j++) {
    lcd.setCursor(j, i);
    lcd.print("HELLO");
    delay(del);
    lcd.clear( );
  }// end of for loop (1)

  // (2)Scrolling from Right to Left
  for (j = 16 ; j >= -5 ; j--) {
    lcd.setCursor(j, i);
    lcd.print("HELLO");
    delay(del);
    lcd.clear( );
  }// end of for loop (2)



  // (3) scrolling in first row from Left-Right-Left then in second row from Left-Right-Left 
  for (i = 0 ; i <= 1 ; i++) {
    for (j = -5 ; j <= 16 ; j++) {
      lcd.setCursor(j, i);
      lcd.print("HELLO ");
      delay(del);
      lcd.clear( );
    }
    for (j = 16 ; j >= -5 ; j--) {
      lcd.setCursor(j, i);
      lcd.print("HELLO ");
      delay(del);
      lcd.clear( );
    }
  }// end of for loop (3)
}// end of loop

OUTPUT

Scroll data on LCD 16x2 using Arduino


READ NEXT
PRINT ASCII CHARACTERS ON LCD 16×2 USING ARDUINO


 

Total Visits: 1280
5 1 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x