In LiquidCrystal library there is a feature to make text on LCD scrolling to left or right. Now I will make a small example how it happened. I made the scrolling text on lcd 16x2 using arduino simulator simulIDE. If you do not have the simulator app, you can download it here.
Code:
// -----------------------------------------------
// LCD 16x2 HD44780-40 Scrolling
// -----------------------------------------------
#include <LiquidCrystal.h>
int D7_pin = 4;
int D6_pin = 5;
int D5_pin = 6;
int D4_pin = 7;
int EN_pin = 11;
int RS_pin = 12;
int i;
LiquidCrystal lcd(RS_pin, EN_pin, D4_pin, D5_pin, D6_pin, D7_pin);
void setup()
{
lcd.begin(16, 2);
}
void loop()
{
right();
delay(100);
left();
delay(500);
}
void right() {
lcd.clear();
lcd.print("First Test");
lcd.setCursor(0, 1);
lcd.print("It's Works !");
delay(1000);
// Move to Right
for (i = 1; i <= 16; i++)
{
lcd.scrollDisplayLeft();
delay(50);
}
}
void left() {
lcd.clear();
lcd.print("Yeay...");
lcd.setCursor(0, 1);
lcd.print("TEXT SCROLLING");
// make this text in the right position in a very fast time
for (i = 1; i <= 16; i++)
{
lcd.scrollDisplayLeft();
delay(0.1);
}
// Move to Left
for (i = 1; i <= 16; i++)
{
lcd.scrollDisplayRight();
delay(50);
}
delay(1000);
// Move to Right again
for (i = 1; i <= 16; i++)
{
lcd.scrollDisplayLeft();
delay(50);
}
}
Video:
Share This :
0 comments