Category:Lcdlib Library

From Pinguino
Jump to: navigation, search


Purpose

This library allows a Pinguino board to control a Liquid Crystal Display (LCD) based on a Hitachi HD44780 (or compatible) controller, as is used on most text-based LCDs. The library allows using either 4 or 8 data lines in addition to the RS, ENABLE, and, optionally, the RW control lines to connect to the LCD display. The library also supports a variety of display formats (16 x 2, 20 x 4 etc).

It is based on LiquidCrystal lib from the Arduino project.

Functions

See under Pages in category "Lcdlib Library" below.

Compatible Boards/Compatibility

Tested with SainSmart LCD shield works, On Olimex Pinguino OTG

  // initialize the library with the numbers of the interface pins
  lcd.pins(8, 9, 4, 5, 6, 7, 0, 0, 0, 0); 

  //  Must write this code on the beginning of setup to turn on back light
  pinMode(10, OUTPUT);
  digitalWrite(10,HIGH);	// Turn on Back Light

How to Use/Include

Example

void setup() {
  pinMode(10, OUTPUT);
  digitalWrite(10,HIGH);  // Turn on contrast
   
  // initialize the library with the numbers of the interface pins
  //lcd.pins(RS, E, D4, D5, D6, D7, 0, 0, 0, 0);     //4 bit mode
  //lcd.pins(RS, E, D0, D1, D2, D3, D4, D5, D6, D7); //8 bit mode
  lcd.pins(8, 9, 4, 5, 6, 7, 0, 0, 0, 0); // Use last 4 pins as zero for 4 bit mode
	
  // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2, 1);          // last 1 is not necessary in 8 bit or 32 bit micros
  lcd.print("Hello, World!");   // Print a message to the LCD.
}

void loop() {
  lcd.setCursor(0, 1); // col, row
  lcd.printf("Pinguino: %d", millis()/1000); // elapsed seconds
  
  delay(100);
  
}

Known Bugs/Limitations

Other Comments/Suggestions

Corrections, suggestions, and new documentation can be made directly on this Wiki

Library Functions