Pantallas LCD - LiquidCrystal

Como las pantallas LCD son el tema principal de este fin de semana, en esta y varias de las próximas entradas del blog presentaremos varios proyectos y guías para pantallas LCD de diferentes fabricantes tanto para Arduino como para Raspberry Pi. Para cada uno de ellos podéis encontrar materiales en nuestra web y esperamos que satisfagan vuestras necesidades y curiosidad.

Para empezar, vamos a empezar con una breve introducción sobre qué pantallas se pueden utilizar con Arduino y cuáles son los requisitos previos reales para cualquiera de los proyectos.

Para una explicación más detallada de los tecnicismos de la pantalla LCD, por favor, consulta nuestra entrada anterior del blog sobre las tecnologías populares utilizadas en las pantallas

En este blog cubriremos los programas básicos de la pantalla de Arduino. Todo el código básico y las guías se obtienen de la página oficial de Arduino bajo la licencia Creative Commons 

Si acabas de empezar con tu Arduino y quieres empezar a jugar con las pantallas LCD, lo primero es instalar la Biblioteca LiquidCrystal

Esta biblioteca permite que una placa Arduino controle las pantallas de cristal líquido (LCD) basadas en el conjunto de chips Hitachi HD44780 (o uno compatible), que se encuentra en la mayoría de las LCD basadas en texto. La biblioteca funciona en modo de 4 u 8 bits (es decir, utilizando 4 u 8 líneas de datos además de las líneas de control rs, enable y, opcionalmente, rw).

Para ello, basta con codificar:

#include <LiquidCrystal.h>

Los LCD tienen una interfaz paralela, lo que significa que el microcontrolador tiene que manipular varios pines de interfaz a la vez para controlar la pantalla. La interfaz consiste en los siguientes pines:

Un pin de selección de registro (RS) que controla en qué parte de la memoria de la LCD está escribiendo datos. Puede seleccionar el registro de datos, que contiene lo que va en la pantalla, o un registro de instrucciones, que es donde el controlador de la LCD busca las instrucciones sobre qué hacer a continuación.

Una clavija de lectura/escritura (R/W) que selecciona el modo de lectura o el modo de escritura

Un pin de habilitación que permite escribir en los registros

8 pines de datos (D0 -D7). Los estados de estos pines (alto o bajo) son los bits que estás escribiendo en un registro cuando escribes, o los valores que estás leyendo cuando lees.

También hay una clavija de contraste de pantalla (Vo), clavijas de alimentación (+5V y Gnd) y clavijas de retroiluminación LED (Bklt+ y BKlt-) que puedes usar para alimentar la pantalla LCD, controlar el contraste de la pantalla y encender y apagar la retroiluminación LED, respectivamente.

A continuación cubriremos algunos programas básicos, incluyendo:

  • Autoscroll: Cambiar el texto a la derecha y a la izquierda.
  • Blink: Control del cursor de estilo de bloque.
  • Cursor: Control del cursor de estilo de subrayado.
  • Display: Borrar rápidamente la pantalla sin perder lo que hay en ella.
  • Hello World: Muestra "¡hola mundo!" y los segundos desde el reinicio.
  • Scroll: Desplazamiento de texto a la izquierda y a la derecha.
  • Serial Display: Acepta la entrada en serie, la muestra.
  • Set Cursor: Establece la posición del cursor.
  • Text Direction: Controla en qué dirección fluye el texto desde el cursor.

Autoscroll

autoscroll() mueve todo el texto un espacio a la izquierda cada vez que se añade una letra

noAutoscroll() apaga el desplazamiento

Este boceto imprime los caracteres del 0 al 9 con desplazamiento automático desactivado, luego mueve el cursor a la parte inferior derecha, activa el desplazamiento automático y los imprime de nuevo.

Hardware requerido

Circuito

Antes de cablear la pantalla LCD a su placa Arduino, sugerimos soldar una tira de encabezamiento de pines al conector de 14 (o 16) pines de la pantalla LCD, como puede ver en la imagen de arriba.

Para cablear la pantalla LCD a su placa, conecte los siguientes pines:

El pin RS de la LCD al pin 12 digital

LCD Habilitar pin a pin digital 11

LCD D4 pin a digital pin 5

LCD D5 pin a digital pin 4

LCD D6 pin a digital pin 3

LCD D7 pin a digital pin 2

Además, cablea un pote de 10k a +5V y GND, con su limpiaparabrisas (salida) a la clavija VO de las pantallas LCD (clavija 3). Se utiliza una resistencia de 220 ohm para alimentar la luz de fondo de la pantalla, normalmente en los pin 15 y 16 del conector LCD

 

 

 

El código

/*

  LiquidCrystal Library - Autoscroll

 

 Demonstrates the use a 16x2 LCD display.  The LiquidCrystal

 library works with all LCD displays that are compatible with the

 Hitachi HD44780 driver. There are many of them out there, and you

 can usually tell them by the 16-pin interface.

 

 This sketch demonstrates the use of the autoscroll()

 and noAutoscroll() functions to make new text scroll or not.

 

 The circuit:

 * LCD RS pin to digital pin 12

 * LCD Enable pin to digital pin 11

 * LCD D4 pin to digital pin 5

 * LCD D5 pin to digital pin 4

 * LCD D6 pin to digital pin 3

 * LCD D7 pin to digital pin 2

 * LCD R/W pin to ground

 * 10K resistor:

 * ends to +5V and ground

 * wiper to LCD VO pin (pin 3)

 

 

 

 

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

 

 This example code is in the public domain.

 

 http://www.arduino.cc/en/Tutorial/LiquidCrystalAutoscroll

 

*/

 

// include the library code:

#include

 

// initialize the library by associating any needed LCD interface pin

// with the arduino pin number it is connected to

const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;

LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

 

void setup() {

// set up the LCD's number of columns and rows:

lcd.begin(16, 2);

}

 

void loop() {

// set the cursor to (0,0):

lcd.setCursor(0, 0);

// print from 0 to 9:

for (int thisChar = 0; thisChar < 10; thisChar++) {

lcd.print(thisChar);

delay(500);

}

 

// set the cursor to (16,1):

lcd.setCursor(16, 1);

// set the display to automatically scroll:

lcd.autoscroll();

// print from 0 to 9:

for (int thisChar = 0; thisChar < 10; thisChar++) {

lcd.print(thisChar);

delay(500);

}

// turn off automatic scrolling

lcd.noAutoscroll();

 

// clear screen for the next loop:

lcd.clear();

}

 Enlace a la pagina original de Arduino

blink() and noBlink()

Este boceto de ejemplo muestra cómo usar los métodos blink() y noBlink() para hacer parpadear un cursor de tipo bloque.

/*

  LiquidCrystal Library - Blink

 Demonstrates the use a 16x2 LCD display.  The LiquidCrystal

 library works with all LCD displays that are compatible with the

 Hitachi HD44780 driver. There are many of them out there, and you

 can usually tell them by the 16-pin interface.

 This sketch prints "Hello World!" to the LCD and makes the

 cursor block blink.

 The circuit:

 * LCD RS pin to digital pin 12

 * LCD Enable pin to digital pin 11

 * LCD D4 pin to digital pin 5

 * LCD D5 pin to digital pin 4

 * LCD D6 pin to digital pin 3

 * LCD D7 pin to digital pin 2

 * LCD R/W pin to ground

 * 10K resistor:

   * ends to +5V and ground

   * wiper to LCD VO pin (pin 3)

 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

 This example code is in the public domain.

 http://www.arduino.cc/en/Tutorial/LiquidCrystalBlink

*/

// include the library code:

#include

// initialize the library by associating any needed LCD interface pin

// with the arduino pin number it is connected to

const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;

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("hello, world!");

}

void loop() {

  // Turn off the blinking cursor:

  lcd.noBlink();

  delay(3000);

  // Turn on the blinking cursor:

  lcd.blink();

  delay(3000);

}

cursor() and noCursor()

Este boceto de ejemplo muestra cómo usar los métodos cursor() y noCursor() para controlar un cursor de tipo underscore.

/*

  LiquidCrystal Library - Cursor

 Demonstrates the use a 16x2 LCD display.  The LiquidCrystal

 library works with all LCD displays that are compatible with the

 Hitachi HD44780 driver. There are many of them out there, and you

 can usually tell them by the 16-pin interface.

 This sketch prints "Hello World!" to the LCD and

 uses the cursor()  and noCursor() methods to turn

 on and off the cursor.

 The circuit:

 * LCD RS pin to digital pin 12

 * LCD Enable pin to digital pin 11

 * LCD D4 pin to digital pin 5

 * LCD D5 pin to digital pin 4

 * LCD D6 pin to digital pin 3

 * LCD D7 pin to digital pin 2

 * LCD R/W pin to ground

 * 10K resistor:

 * ends to +5V and ground

 * wiper to LCD VO pin (pin 3)

 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

 This example code is in the public domain.

 http://www.arduino.cc/en/Tutorial/LiquidCrystalCursor

*/

// include the library code:

#include

// initialize the library by associating any needed LCD interface pin

// with the arduino pin number it is connected to

const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;

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("hello, world!");

}

void loop() {

  // Turn off the cursor:

  lcd.noCursor();

  delay(500);

  // Turn on the cursor:

  lcd.cursor();

  delay(500);

}

display() and noDisplay()

Este boceto de ejemplo muestra cómo usar los métodos display() y noDisplay() para encender y apagar la pantalla. El texto a mostrar se conservará cuando se use noDisplay(), por lo que es una forma rápida de borrar la pantalla sin perder todo lo que hay en ella.

/*

  LiquidCrystal Library - display() and noDisplay()

 Demonstrates the use a 16x2 LCD display.  The LiquidCrystal

 library works with all LCD displays that are compatible with the

 Hitachi HD44780 driver. There are many of them out there, and you

 can usually tell them by the 16-pin interface.

 This sketch prints "Hello World!" to the LCD and uses the

 display() and noDisplay() functions to turn on and off

 the display.

 The circuit:

 * LCD RS pin to digital pin 12

 * LCD Enable pin to digital pin 11

 * LCD D4 pin to digital pin 5

 * LCD D5 pin to digital pin 4

 * LCD D6 pin to digital pin 3

 * LCD D7 pin to digital pin 2

 * LCD R/W pin to ground

 * 10K resistor:

 * ends to +5V and ground

 * wiper to LCD VO pin (pin 3)

 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

 This example code is in the public domain.

 http://www.arduino.cc/en/Tutorial/LiquidCrystalDisplay

*/

// include the library code:

#include

// initialize the library by associating any needed LCD interface pin

// with the arduino pin number it is connected to

const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;

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("hello, world!");

}

void loop() {

  // Turn off the display:

  lcd.noDisplay();

  delay(500);

  // Turn on the display:

  lcd.display();

  delay(500);

}

Hello, World

Este boceto de ejemplo imprime "¡Hello, World!" en el LCD y muestra el tiempo en segundos desde que el Arduino fue reseteado.

/*

  LiquidCrystal Library - Hello World

 Demonstrates the use a 16x2 LCD display.  The LiquidCrystal

 library works with all LCD displays that are compatible with the

 Hitachi HD44780 driver. There are many of them out there, and you

 can usually tell them by the 16-pin interface.

 This sketch prints "Hello World!" to the LCD

 and shows the time.

  The circuit:

 * LCD RS pin to digital pin 12

 * LCD Enable pin to digital pin 11

 * LCD D4 pin to digital pin 5

 * LCD D5 pin to digital pin 4

 * LCD D6 pin to digital pin 3

 * LCD D7 pin to digital pin 2

 * LCD R/W pin to ground

 * LCD VSS pin to ground

 * LCD VCC pin to 5V

 * 10K resistor:

 * ends to +5V and ground

 * wiper to LCD VO pin (pin 3)

 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

 This example code is in the public domain.

 http://www.arduino.cc/en/Tutorial/LiquidCrystal

 */

// include the library code:

#include

// initialize the library with the numbers of the interface pins

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {

  // set up the LCD's number of columns and rows:

  lcd.begin(16, 2);

  // Print a message to the LCD.

  lcd.print("hello, world!");

}

void loop() {

  // set the cursor to column 0, line 1

  // (note: line 1 is the second row, since counting begins with 0):

  lcd.setCursor(0, 1);

  // print the number of seconds since reset:

  lcd.print(millis() / 1000);

}

scrollDisplayLeft() and scrollDisplayRight()

Este boceto de ejemplo muestra cómo usar los métodos scrollDisplayLeft() y scrollDisplayRight() para invertir la dirección en la que fluye el texto. Imprime "¡Hola Mundo!", lo desplaza fuera de la pantalla a la izquierda, luego fuera de la pantalla a la derecha, y luego de vuelta a casa.

/*

  LiquidCrystal Library - scrollDisplayLeft() and scrollDisplayRight()

 Demonstrates the use a 16x2 LCD display.  The LiquidCrystal

 library works with all LCD displays that are compatible with the

 Hitachi HD44780 driver. There are many of them out there, and you

 can usually tell them by the 16-pin interface.

 This sketch prints "Hello World!" to the LCD and uses the

 scrollDisplayLeft() and scrollDisplayRight() methods to scroll

 the text.

  The circuit:

 * LCD RS pin to digital pin 12

 * LCD Enable pin to digital pin 11

 * LCD D4 pin to digital pin 5

 * LCD D5 pin to digital pin 4

 * LCD D6 pin to digital pin 3

 * LCD D7 pin to digital pin 2

 * LCD R/W pin to ground

 * 10K resistor:

 * ends to +5V and ground

 * wiper to LCD VO pin (pin 3)

 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

 This example code is in the public domain.

 http://www.arduino.cc/en/Tutorial/LiquidCrystalScroll

 */

// include the library code:

#include

// initialize the library with the numbers of the interface pins

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {

  // set up the LCD's number of columns and rows:

  lcd.begin(16, 2);

  // Print a message to the LCD.

  lcd.print("hello, world!");

  delay(1000);

}

void loop() {

  // scroll 13 positions (string length) to the left

  // to move it offscreen left:

  for (int positionCounter = 0; positionCounter < 13; positionCounter++) {

    // scroll one position left:

    lcd.scrollDisplayLeft();

    // wait a bit:

    delay(150);

  }

  // scroll 29 positions (string length + display length) to the right

  // to move it offscreen right:

  for (int positionCounter = 0; positionCounter < 29; positionCounter++) {

    // scroll one position right:

    lcd.scrollDisplayRight();

    // wait a bit:

    delay(150);

  }

  // scroll 16 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);

}

Serial Input

Este boceto de ejemplo acepta la entrada en serie de un ordenador central y la muestra en la pantalla LCD. Para usarlo, carga el boceto, luego abrr el Monitor de serie y escribr algunos caracteres y haz clic en Enviar. El texto aparecerá en la pantalla LCD.

/*

  LiquidCrystal Library - Serial Input

 Demonstrates the use a 16x2 LCD display.  The LiquidCrystal

 library works with all LCD displays that are compatible with the

 Hitachi HD44780 driver. There are many of them out there, and you

 can usually tell them by the 16-pin interface.

 This sketch displays text sent over the serial port

 (e.g. from the Serial Monitor) on an attached LCD.

 The circuit:

 * LCD RS pin to digital pin 12

 * LCD Enable pin to digital pin 11

 * LCD D4 pin to digital pin 5

 * LCD D5 pin to digital pin 4

 * LCD D6 pin to digital pin 3

 * LCD D7 pin to digital pin 2

 * LCD R/W pin to ground

 * 10K resistor:

 * ends to +5V and ground

 * wiper to LCD VO pin (pin 3)

 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

 This example code is in the public domain.

 http://www.arduino.cc/en/Tutorial/LiquidCrystalSerial

 */

// include the library code:

#include

// initialize the library with the numbers of the interface pins

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {

  // set up the LCD's number of columns and rows:

  lcd.begin(16, 2);

  // initialize the serial communications:

  Serial.begin(9600);

}

void loop() {

  // when characters arrive over the serial port...

  if (Serial.available()) {

    // wait a bit for the entire message to arrive

    delay(100);

    // clear the screen

    lcd.clear();

    // read all the available characters

    while (Serial.available() > 0) {

      // display each character to the LCD

      lcd.write(Serial.read());

    }

  }

}

setCursor()

Este boceto de ejemplo muestra cómo usar el método setCursor() para reposicionar el cursor. Para mover el cursor, basta con llamar a setCursor() con una posición de fila y columna. Por ejemplo, para una pantalla de 2x16:

lcd.setCursor(0, 0); // arriba a la izquierda

lcd.setCursor(15, 0); // arriba a la derecha

lcd.setCursor(0, 1); // abajo a la izquierda

lcd.setCursor(15, 1); // abajo a la derecha

/*

  LiquidCrystal Library - setCursor

 Demonstrates the use a 16x2 LCD display.  The LiquidCrystal

 library works with all LCD displays that are compatible with the

 Hitachi HD44780 driver. There are many of them out there, and you

 can usually tell them by the 16-pin interface.

 This sketch prints to all the positions of the LCD using the

 setCursor() method:

  The circuit:

 * LCD RS pin to digital pin 12

 * LCD Enable pin to digital pin 11

 * LCD D4 pin to digital pin 5

 * LCD D5 pin to digital pin 4

 * LCD D6 pin to digital pin 3

 * LCD D7 pin to digital pin 2

 * LCD R/W pin to ground

 * 10K resistor:

 * ends to +5V and ground

 * wiper to LCD VO pin (pin 3)

 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

 This example code is in the public domain.

 http://www.arduino.cc/en/Tutorial/LiquidCrystalSetCursor

*/

// include the library code:

#include

// initialize the library by associating any needed LCD interface pin

// with the arduino pin number it is connected to

const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;

LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

// these constants won't change.  But you can change the size of

// your LCD using them:

const int numRows = 2;

const int numCols = 16;

void setup() {

  // set up the LCD's number of columns and rows:

  lcd.begin(numCols, numRows);

}

void loop() {

  // loop from ASCII 'a' to ASCII 'z':

  for (int thisLetter = 'a'; thisLetter <= 'z'; thisLetter++) {

    // loop over the columns:

    for (int  thisRow = 0; thisRow < numRows; thisRow++) {

      // loop over the rows:

      for (int thisCol = 0; thisCol < numCols; thisCol++) {

        // set the cursor position:

        lcd.setCursor(thisCol, thisRow);

        // print the letter:

        lcd.write(thisLetter);

        delay(200);

      }

    }

  }

}

Text Direction methods leftToRight() and rightToLeft()

Este boceto de ejemplo muestra cómo usar los métodos leftToRight() y rightToLeft(). Estos métodos controlan la forma en que el texto fluye desde el cursor.

rightToLeft() hace que el texto fluya hacia la izquierda desde el cursor, como si la pantalla se justificara por la derecha.

leftToRight() causa que el texto fluya a la derecha desde el cursor, como si la pantalla se justificara a la izquierda.

Este boceto imprime a través de l de derecha a izquierda, luego m a través de r de izquierda a derecha, y luego s a través de z de derecha a izquierda otra vez

/*

 LiquidCrystal Library - TextDirection

 Demonstrates the use a 16x2 LCD display.  The LiquidCrystal

 library works with all LCD displays that are compatible with the

 Hitachi HD44780 driver. There are many of them out there, and you

 can usually tell them by the 16-pin interface.

 This sketch demonstrates how to use leftToRight() and rightToLeft()

 to move the cursor.

 The circuit:

  * LCD RS pin to digital pin 12

  * LCD Enable pin to digital pin 11

  * LCD D4 pin to digital pin 5

  * LCD D5 pin to digital pin 4

  * LCD D6 pin to digital pin 3

  * LCD D7 pin to digital pin 2

  * LCD R/W pin to ground

  * 10K resistor:

  * ends to +5V and ground

  * wiper to LCD VO pin (pin 3)

 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

 This example code is in the public domain.

 http://www.arduino.cc/en/Tutorial/LiquidCrystalTextDirection

*/

// include the library code:

#include

// initialize the library by associating any needed LCD interface pin

// with the arduino pin number it is connected to

const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;

LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

int thisChar = 'a';

void setup() {

  // set up the LCD's number of columns and rows:

  lcd.begin(16, 2);

  // turn on the cursor:

  lcd.cursor();

}

void loop() {

  // reverse directions at 'm':

  if (thisChar == 'm') {

    // go right for the next letter

    lcd.rightToLeft();

  }

  // reverse again at 's':

  if (thisChar == 's') {

    // go left for the next letter

    lcd.leftToRight();

  }

  // reset at 'z':

  if (thisChar > 'z') {

    // go to (0,0):

    lcd.home();

    // start again at 0

    thisChar = 'a';

  }

  // print the character

  lcd.write(thisChar);

  // wait a second:

  delay(1000);

  // increment the letter:

  thisChar++;

}

Artículos relacionados

Share