pravynandas
Published © GPL3+

LCD 1602 Scroll text (Line 1 static, Line 2 Scrolling)

A simple project from a Arduino newbie

BeginnerFull instructions provided19,396
LCD 1602 Scroll text (Line 1 static, Line 2 Scrolling)

Things used in this project

Story

Read more

Schematics

Breadboard connection

Schematic

Code

Arduino IDE Code

Arduino
Display one static line "Sing Along" and one scrolling line, on a LCD 16x2
#include <LiquidCrystal.h>
//                BS  E  D4 D5  D6 D7
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
char * messagePadded = "                Twinkle Twinkle Little star how I wonder what you are, up above the world so high, like a diamond in the sky.                ";

void setup()
{
  lcd.begin (16, 2);
  lcd.setCursor(3, 0);
  lcd.print("Sing Along");
}

void loop()
{
  for (int letter = 0; letter <= strlen(messagePadded) - 16; letter++) //From 0 to upto n-16 characters supply to below function
  {
    showLetters(0, letter);
  }
}

void showLetters(int printStart, int startLetter)
{
  lcd.setCursor(printStart, 1);
  for (int letter = startLetter; letter <= startLetter + 15; letter++) // Print only 16 chars in Line #2 starting 'startLetter'
  {
    lcd.print(messagePadded[letter]);
  }
  lcd.print(" ");
  delay(250);
}

Credits

pravynandas

pravynandas

1 project • 3 followers

Comments