How to Make a Scrolling Effect On LCD Arduino

Posted on

Scrolling Effect On LCD Arduino – In certain applications, the scroll text effect is used to display long words or file names. Using an Arduino 16 × 2 LCD we can make scrolling text effects easily. On the Arduino IDE, two examples have been given to create a scrolling text effect with the name Scroll and Autoscroll. But in this article, I will give a different program code.

In the example Scroll program and Autoscroll, it will make all the text in the LCD line is scroll. How do we make scrolling text on just one line? Look at the following picture;

 

Code Progam For Scrolling Text  Only 1 Line

The basic program in this Scrolling Effect On LCD Arduino article from the website www.arduinotutorialonline.com. But there are several lines of programs that I changed. Look at to the following program.

#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);

int lcdCol = 16;
int lcdRow = 2;


String text1 = "Hambo Elektronik"; 
String text2 = "Welcome to my Blog. Happy Learning :)"; 

int Start = 0; 
int Stop  = 0;
int Cursor = lcdCol;

void setup()
{
  lcd.begin(16,2);                     
  lcd.setCursor(0,0); 
}

void loop()
{
   
  lcd.setCursor(0, 0);
  lcd.print(text1);
  
  lcd.setCursor(Cursor, 1);
  lcd.print(text2.substring(Start,Stop));
  
  delay(400);

  lcd.clear();
  
  if(Start == 0 && Cursor > 0){
    Cursor--;
    Stop++;
  } else if (Start == Stop){
    Start = Stop = 0;
    Cursor = lcdCol;
  } else if (Stop == text2.length() && Cursor == 0) {
    Start++;
  } else {
    Start++;
    Stop++;
  }
  
}

Please upload the program above to your Arduino.

Read other articles  Arduino Nano Port Not Detected Chip CH340

Leave a Reply

Your email address will not be published. Required fields are marked *