Created
December 17, 2016 19:11
-
-
Save PandaWhoCodes/b754976cc4fde9198c49df8968ca26cb to your computer and use it in GitHub Desktop.
A better way to display large texts in your arduino uno 16 x 2 display without using the display scroll 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
// include the library code: | |
#include <LiquidCrystal.h> | |
// initialize the library with the numbers of the interface pins | |
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); | |
int okay=0; | |
void setup() { | |
// set up the LCD's number of columns and rows: | |
lcd.begin(16, 2); | |
// Print a message to the LCD. | |
delay(1000); | |
} | |
void myprintfunc(String s) | |
{ | |
//printing forwards | |
int l=s.length(); | |
for(int i=0;i<l-15;i++) | |
{ | |
lcd.clear(); | |
lcd.print(s.substring(i,i+16)); | |
delay(500); | |
} | |
//printing backwards | |
delay(2000); | |
//delay of 2 sec before going back | |
for(int i=l-1;i>=16;i--) | |
{ | |
lcd.clear(); | |
lcd.print(s.substring(i,i-16)); | |
delay(350); | |
} | |
} | |
void loop() { | |
myprintfunc("This is a test to check and test and see how this function handles large strings."); | |
delay(1000); | |
//Delay of 1 sec before retarting the loop | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment