Scrolling one line on 16 x 2 LCD

Hi, I’ve been trying to figure out how to scroll only one line on a 16 x 2 LCD, and I found this code
However, I cannot figure out how to modify it to make it scroll to the right. It seemed simple, but none of my codes worked.
I would greatly appreciate it if someone could tell me how to fix this.

Will help scroll just one line in LCD
The other will be static.

In this case 1st line: scrolling and 2nd line: static


The circuit:

  • LCD RS pin to digital pin 12
  • LCD Enable pin to digital pin 11
  • LCD D4 pin to digital pin 5
  • LCD D5 pin to digital pin 4
  • LCD D6 pin to digital pin 3
  • LCD D7 pin to digital pin 2
  • LCD R/W pin to ground
  • 10K resistor:
  • ends to +5V and ground
  • wiper to LCD VO pin (pin 3)

// include the library
#include <LiquidCrystal.h>

// init the lcd display according to the circuit
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

// it’s a 16x2 LCD so…
int screenWidth = 16;
int screenHeight = 2;

// the two lines
// line1 = scrolling
String line1 = “This is a line scrolling tutorial by whizzzkid!”;
// line2 = static
String line2 = " Whizzzkid Inc. ";

// just some reference flags
int stringStart, stringStop = 0;
int scrollCursor = screenWidth;

// most of the part is pretty basic
void setup() {

void loop() {
lcd.setCursor(scrollCursor, 0);
lcd.setCursor(0, 1);
if(stringStart == 0 && scrollCursor > 0){
} else if (stringStart == stringStop){
stringStart = stringStop = 0;
scrollCursor = screenWidth;
} else if (stringStop == line1.length() && scrollCursor == 0) {
} else {
Raw file | Repository | Atlassian Bitbucket

However, I cannot figure out how to modify it to make it scroll to the right.

Use some Serial.print() statements to figure out what makes the text scroll to the left.

The changing values of scrollStart and scrollStop define the portion of the String to be displayed. Decrementing instead of incrementing ought to make the text appear to scroll the other way.