Advertisement
ossipee

arduino lcd template

Jan 18th, 2014
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.19 KB | None | 0 0
  1. /*Modded Code from http://www.mathias-wilhelm.de/arduino/download/
  2.  
  3.  */
  4.  
  5. // include the library code:
  6. #include <LiquidCrystal.h>
  7.  
  8. // initialize the library with the numbers of the interface pins
  9. //LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
  10. LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
  11.  
  12. //
  13. const int ScrollTextLength = 11;
  14. String ScrollTextField[ScrollTextLength] = {
  15.   " Chris          ",
  16.   "   LOVES        ",
  17.   "       Diana    ",
  18.   "Honey           ",
  19.   "   Baby         ",
  20.   "     Sweety     ",
  21.   "       Pie      ",
  22.   " I love you!    ",
  23.   "    Paradise    ",
  24.   "Poter! Porter!  ",
  25.   "Maine.......... ",};
  26.  
  27. void setup() {
  28.  
  29.  
  30.   // set up the lcd's number of columns and rows:
  31.   lcd.begin(16, 2);
  32.  
  33.   Serial.begin(115200);
  34.  
  35. }
  36.  
  37. void loop() {
  38.  
  39.  
  40.   delay(1000);
  41.   ScrollText(1000);
  42.   delay(2000);
  43. }
  44.  
  45.  
  46.  
  47. void ScrollText (int sdelay) {
  48.   String outp;
  49.   int sline=0;
  50.   for (int i=0; i<ScrollTextLength; i++) {
  51.     sline=i;
  52.     lcd.setCursor(0, 0);
  53.     outp=ScrollTextField[sline];
  54.     lcd.print(outp);
  55.     sline=i+1;
  56.     if (sline>=ScrollTextLength) sline = 0;
  57.     lcd.setCursor(0, 1);
  58.     outp=ScrollTextField[sline];
  59.     lcd.print(outp);
  60.     delay(sdelay);
  61.   }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement