/* LiquidCrystal Library - scrollDisplayLeft() and scrollDisplayRight() The circuit: * LCD RS pin to digital pin 2 * LCD Enable pin to digital pin 3 * LCD D4 pin to digital pin 8 * LCD D5 pin to digital pin 9 * LCD D6 pin to digital pin 10 * LCD D7 pin to digital pin 11 * LCD R/W pin to ground * V0 (contrast) to ground * K (kathode) to ground for backlight * A (anode) through a 220 ohm resistor to +5V * VSS to ground * VDD to +5V Library originally added 18 Apr 2008 by David A. Mellis library modified 5 Jul 2009 by Limor Fried (http://www.ladyada.net) example added 9 Jul 2009 by Tom Igoe modified 22 Nov 2010 by Tom Igoe modified 7 Nov 2016 by Arturo Guadalupi Modified 2019 by Ian Juby for Robotics: Learn by building course 2, digital electronics (www.JetPackAcademy.com) This example code is in the public domain. https://www.arduino.cc/en/Reference/LiquidCrystal */ #include // initialize the library by associating any needed LCD interface pin // with the arduino pin number it is connected to const int rs = 2, en = 3, d4 = 8, d5 = 9, d6 = 10, d7 = 11; LiquidCrystal lcd(rs, en, d4, d5, d6, d7); void setup() { // set up the LCD's number of columns and rows: lcd.begin(16, 2); // Print a message to the LCD. lcd.print("This is a message"); //Put whatever you want to display in the quotes. Note the length of the string, you'll need it. delay(1000); } void loop() { // scroll 17 positions (whatever your string length is) to the left // to move it offscreen left: for (int positionCounter = 0; positionCounter < 17; positionCounter++) { // scroll one position left: lcd.scrollDisplayLeft(); // wait a bit: delay(150); } // scroll 33 positions (string length + display length) to the right // to move it offscreen right: for (int positionCounter = 0; positionCounter < 33; positionCounter++) { // scroll one position right: lcd.scrollDisplayRight(); // wait a bit: delay(150); } // scroll 33 positions (display length + string length) to the left // to move it back to center: for (int positionCounter = 0; positionCounter < 16; positionCounter++) { // scroll one position left: lcd.scrollDisplayLeft(); // wait a bit: delay(150); } // delay at the end of the full loop: delay(1000); }