Created
November 18, 2016 17:25
-
-
Save RecNes/2b199bac521158a9983891fe6df39721 to your computer and use it in GitHub Desktop.
Arduino gist for proper usage of vertical scrolling on each output with 16x2 LCD display.
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
#include <LiquidCrystal.h> | |
String Line1; | |
String Line2; | |
LiquidCrystal lcd(7, 8, 9, 10, 11, 12); | |
void lcdPrint(String lcdText) { | |
lcd.clear(); | |
Line1 = Line2; | |
lcd.setCursor(0, 0); | |
lcd.print(Line1); | |
Line2 = lcdText; | |
Line2.replace("\r\n", ""); | |
lcd.setCursor(0, 1); | |
lcd.print(Line2); | |
Line1 = ""; | |
lcdText = ""; | |
} | |
void setup() { | |
lcd.begin(16, 2); | |
lcdPrint("LCD Initialized!"); | |
lcdPrint("DEMO LINE 1"); | |
lcdPrint("DEMO LINE 2"); | |
lcdPrint("DEMO LINE 3"); | |
lcdPrint("DEMO LINE 4"); | |
lcdPrint("DEMO LINE 5"); | |
} | |
void loop() { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment