Playground.arduino.cc will be read-only starting December 31st, 2018. For more info please look at this Forum Post

serLCD

setType()

Description

The SerLCD firmware v2.5 supports setting different types of LCD's. This function allows to easily set the type of LCD.

The function expects a parameter value of 3 - 6:
3: 2x16 LCD
4: 2x20 LCD
5: 4x16 LCD
6: 4x20 LCD

After changing the settings, the value is written to the EEPROM so the SerialLCD will remember it even after a power-off.

Syntax

lcd.setType()

Parameters

lcd: a variable of type serLCD

Example

  1. /*
  2.   serLCD - Set LCD Type Example
  3. */
  4. #include <SoftwareSerial.h> // in Arduino 1.x.x
  5. #include <serLCD.h>
  6.  
  7. // Set pin to the LCD's rxPin
  8. int pin = 2;
  9.  
  10. serLCD lcd(pin);
  11.  
  12. void setup()
  13. {
  14.   lcd.setType(5);
  15.   lcd.clear();
  16.   lcd.print("This LCD a 4x16.");
  17.   lcd.print("This LCD a 4x16.");
  18.   lcd.print("This LCD a 4x16.");
  19.   lcd.print("This LCD a 4x16.");
  20. }
  21.  
  22. void loop() {}