Scrolling text on LCD

Here is a way to scroll a text on LCD screen:

// C++ code
#include <Adafruit_LiquidCrystal.h>
String text="Hello & Karokh";
Adafruit_LiquidCrystal lcd_1(0);
void setup(){
  lcd_1.begin(16, 2);
}
void loop()
{
  for(int i=0;i<16;i++){
    lcd_1.clear();
    lcd_1.setCursor(i, 0);
    lcd_1.print(text);
    if(i+text.length()>16){
    int y = i+text.length()-16;
      int row=0;
      for(int j=text.length()-y;j<text.length();j++){
      lcd_1.setCursor(row, 0);
        row++;
    lcd_1.print(text[j]);
      }
    }
    delay(200);
  } 
}

Welcome to the forum

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

1 Like

Hi,
If you have any difficulties with your project,
explain the difficulty.
Inform which arduino you are using.
Post a schematic of your project. It can be done freehand.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.