Eric Fossum / SerialLCD

Dependents:   ForEhab Serial_HelloWorld_Mbed ForOfek

Fork of LCDSerial by Robert Ellis

Embed: (wiki syntax)

« Back to documentation index

SerialLCD Class Reference

SerialLCD Class Reference

SparkFun SerLCD v2.5 Controller. More...

#include <SerialLCD.h>

Public Member Functions

 SerialLCD (PinName tx, uint8_t type=3)
 Constructor.
void blink ()
 Blinks the cursor.
void clear ()
 Clears the whole LCD and sets the cursor to the first row, first column.
void clearLine (uint8_t)
 Clears the current line and resets the cursor to the beginning of the line.
void createChar (uint8_t, uint8_t[])
 Creates a custom character for the LCD.
void cursor ()
 Display the LCD cursor: an underscore (line) at the position to which the next character will be written.
void display ()
 Turns on the LCD display, after it's been turned off with noDisplay().
void home ()
 Positions the cursor in the upper-left of the LCD.
void leftToRight ()
 Set the direction for text written to the LCD to left-to-right, the default.
void noBlink ()
 Turns off the blinking LCD cursor.
void noCursor ()
 Hides the LCD cursor.
void noDisplay ()
 Turns off the LCD display, without losing the text currently shown on it.
void printCustomChar (uint8_t)
 Print a custom character (gylph) on to the LCD.
void rightToLeft ()
 Set the direction for text written to the LCD to right-to-left (the default is left-to-right).
void scrollLeft ()
 Scrolls the text on the LCD one position to the left.
void scrollRight ()
 Scrolls the text on the LCD one position to the right.
void selectLine (uint8_t line)
 Moves the cursor to the beginning of selected line.
void setBrightness (uint8_t num)
 Sets the backlight brightness based on input value.
void setCursor (uint8_t row, uint8_t col)
 Position the LCD cursor.
void setSplash ()
 Saves the first 2 lines of text that are currently printed on the LCD screen to memory as the new splash screen.
void setType (uint8_t type)
 The SerLCD firmware v2.5 supports setting different types of LCD's.
void toggleSplash ()
 Toggles the splash screen on/off.

Detailed Description

SparkFun SerLCD v2.5 Controller.

Copied from the Arduino.cc SerLCD library.

See also:
http://playground.arduino.cc/Code/SerLCD

Definition at line 54 of file SerialLCD.h.


Constructor & Destructor Documentation

SerialLCD ( PinName  tx,
uint8_t  type = 3 
)

Constructor.

Parameters:
txConnected to rx pin of LCD
typeType of LCD (Optional default 16x2)

Definition at line 3 of file SerialLCD.cpp.


Member Function Documentation

void blink (  )

Blinks the cursor.

This blinks the whole box or just the cursor bar.

Definition at line 109 of file SerialLCD.cpp.

void clear (  )

Clears the whole LCD and sets the cursor to the first row, first column.

Definition at line 17 of file SerialLCD.cpp.

void clearLine ( uint8_t  line )

Clears the current line and resets the cursor to the beginning of the line.

Definition at line 22 of file SerialLCD.cpp.

void createChar ( uint8_t  location,
uint8_t  charmap[] 
)

Creates a custom character for the LCD.

Parameters:
locationLocation to store the char (1-8)
dataByte array containing the enabled pixel bits

  #include <NewSoftSerial.h>
  #include <serLCD.h>
  
  // Set pin to the LCD's rxPin
  int pin = 2;
   
  serLCD lcd(pin);
   
  byte bars[8][8] = {
    {B00000,B00000,B00000,B00000,B00000,B00000,B00000,B11111},
    {B00000,B00000,B00000,B00000,B00000,B00000,B11111,B11111},
    {B00000,B00000,B00000,B00000,B00000,B11111,B11111,B11111},
    {B00000,B00000,B00000,B00000,B11111,B11111,B11111,B11111},
    {B00000,B00000,B00000,B11111,B11111,B11111,B11111,B11111},
    {B00000,B00000,B11111,B11111,B11111,B11111,B11111,B11111},
    {B00000,B11111,B11111,B11111,B11111,B11111,B11111,B11111},
    {B11111,B11111,B11111,B11111,B11111,B11111,B11111,B11111}
  };
   
  void main() {
    for (int i=1; i < 9; i++){
      lcd.createChar(i, bars[i-1]);
    }
    for (int i=1; i < 9; i++){
      lcd.printCustomChar(i);
    }
    while(1);
  }

Definition at line 156 of file SerialLCD.cpp.

void cursor (  )

Display the LCD cursor: an underscore (line) at the position to which the next character will be written.

This does not define if it blinks or not.

Definition at line 121 of file SerialLCD.cpp.

void display (  )

Turns on the LCD display, after it's been turned off with noDisplay().

This will restore the text (and cursor) that was on the display.

Definition at line 133 of file SerialLCD.cpp.

void home (  )

Positions the cursor in the upper-left of the LCD.

Definition at line 45 of file SerialLCD.cpp.

void leftToRight (  )

Set the direction for text written to the LCD to left-to-right, the default.

This means that subsequent characters written to the display will go from left to right, but does not affect previously-output text.

Definition at line 97 of file SerialLCD.cpp.

void noBlink (  )

Turns off the blinking LCD cursor.

Definition at line 115 of file SerialLCD.cpp.

void noCursor (  )

Hides the LCD cursor.

Definition at line 127 of file SerialLCD.cpp.

void noDisplay (  )

Turns off the LCD display, without losing the text currently shown on it.

Definition at line 139 of file SerialLCD.cpp.

void printCustomChar ( uint8_t  num )

Print a custom character (gylph) on to the LCD.

Up to eight characters of 5x8 pixels are supported (numbered 1 to 8). The custom characters are designed by the createChar() command.

Parameters:
locationWhich character to print (1 to 8), created by createChar()

Definition at line 166 of file SerialLCD.cpp.

void rightToLeft (  )

Set the direction for text written to the LCD to right-to-left (the default is left-to-right).

This means that subsequent characters written to the display will go from right to left, but does not affect previously-output text.

Definition at line 103 of file SerialLCD.cpp.

void scrollLeft (  )

Scrolls the text on the LCD one position to the left.

Definition at line 171 of file SerialLCD.cpp.

void scrollRight (  )

Scrolls the text on the LCD one position to the right.

Definition at line 176 of file SerialLCD.cpp.

void selectLine ( uint8_t  line )

Moves the cursor to the beginning of selected line.

Line numbers start with 1. Valid line numbers are 1-4.

Parameters:
lineLine number to go to

Definition at line 31 of file SerialLCD.cpp.

void setBrightness ( uint8_t  num )

Sets the backlight brightness based on input value.

Values range from 1-30. brightness 1 = Off -> 30 = Full Brightness

Definition at line 38 of file SerialLCD.cpp.

void setCursor ( uint8_t  row,
uint8_t  col 
)

Position the LCD cursor.

Parameters:
rowRow position of the cursor (1 being the first row)
colColumn position the cursor (1 being the first column)

Definition at line 145 of file SerialLCD.cpp.

void setSplash (  )

Saves the first 2 lines of text that are currently printed on the LCD screen to memory as the new splash screen.

  void setup()
  {
     lcd.print("      New       ");
     lcd.print(" Splash Screen! ");
     lcd.setSplash();
  }

Definition at line 50 of file SerialLCD.cpp.

void setType ( uint8_t  type )

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: Defines: LCD_2X16(3) - 2x16 LCD LCD_2X20(4) - 2x20 LCD LCD_4X16(5) - 4x16 LCD LCD_4X20(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.

Definition at line 55 of file SerialLCD.cpp.

void toggleSplash (  )

Toggles the splash screen on/off.

Definition at line 92 of file SerialLCD.cpp.