Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. // Lab 11
  2. // Cristian Córdoba
  3. // Universidad Santiago de Cali
  4. // Versión 1.0
  5.  
  6. // include the library code:
  7. #include <LiquidCrystal.h>
  8.  
  9. // initialize the library with the numbers of the interface pins
  10. LiquidCrystal lcd(8, 13, 9, 4, 5, 6, 7);
  11.  
  12. void setup() {
  13.   // set up the LCD's number of columns and rows:
  14.   lcd.begin(16, 2);
  15.   // Print a message to the LCD.
  16.   lcd.print("Cristian David Cordoba Palacios");
  17.   delay(1000);
  18. }
  19.  
  20. void loop() {
  21.   // scroll 13 positions (string length) to the left
  22.   // to move it offscreen left:
  23.   for (int positionCounter = 0; positionCounter < 13; positionCounter++) {
  24.     // scroll one position left:
  25.     lcd.scrollDisplayLeft();
  26.     // wait a bit:
  27.     delay(150);
  28.   }
  29.  
  30.   // scroll 29 positions (string length + display length) to the right
  31.   // to move it offscreen right:
  32.   for (int positionCounter = 0; positionCounter < 29; positionCounter++) {
  33.     // scroll one position right:
  34.     lcd.scrollDisplayRight();
  35.     // wait a bit:
  36.     delay(150);
  37.   }
  38.  
  39.     // scroll 16 positions (display length + string length) to the left
  40.     // to move it back to center:
  41.   for (int positionCounter = 0; positionCounter < 16; positionCounter++) {
  42.     // scroll one position left:
  43.     lcd.scrollDisplayLeft();
  44.     // wait a bit:
  45.     delay(150);
  46.   }
  47.  
  48.   // delay at the end of the full loop:
  49.   delay(1000);
  50. }