Created
May 12, 2016 16:47
-
-
Save emmanuelnk/f3819f44d4b7bfa9e56ff458f7fbb541 to your computer and use it in GitHub Desktop.
lcd2LineDisplay Function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void lcd2LineDisplay(String UpString, String DownString, int delaytime) { | |
//LiquidCrystal_I2C lcd(0x27, 16, 2); //Create a new LiquidCrystal_I2C object if one hasn't been globally created | |
//lcd.backlight(); //Turn on backlight everytime the function runs | |
lcd.clear(); | |
delay(500); | |
lcd.setCursor(0, 0); | |
lcd.print(UpString); | |
lcd.setCursor(0, 1); | |
lcd.print(DownString); | |
if (UpString.length() > 16 || DownString.length() > 16) { | |
int chlimit = 20; | |
if (UpString.length() >= DownString.length() ? chlimit = UpString.length() : chlimit = DownString.length()); | |
int count = 0; | |
delay(1000); | |
while (count < chlimit - 15) { | |
lcd.scrollDisplayLeft(); | |
delay(700); | |
count++; | |
} | |
} | |
delay(delaytime); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment