| ||
|
Shopping Cart
|
| Home | MP3 Player | 8051 Tools | All Projects | PJRC Store | Site Map |
|
You are here:
Teensy
| Search PJRC |
|
LiquidCrystal LibraryLiquidCrystal lets you use small character type displays. Characters and a limited set of custom symbols can be used.Download: LiquidCrystal is included with Arduino software LiquidCrystal works perfectly with Teensy and Teensy++. Hardware Requirements
The R/W pin should to be connected to ground. There is an option to "use" the R/W pin, but LiquidCrystal never actually uses it, so just connect R/W to directly to ground. Only 6 wires are needed between the Teensy and the LCD, and you can use any pins. Just list those 6 pin numbers when you create the LiquidCrystal object.
Pins 7 to 10 (D0 to D3) are not needed. There is an option to use these for higher
speed. Unlike R/W, LiquidCrystal will use these other pins if you connect them,
but rarely is the small speedup worth the trouble of 4 more wires.
Basic UsageLiquidCrystal lcd(RS, Enable, D4, D5, D6, D7)Create the LiquidCrystal object and specify the 6 pins where the LCD is connected. The library offers ways to connect more wires, but there is little advantage to using more than 6. You can connect more than one LCD (each to its own 6 pins) and create a separate LiquidCrystal objects for each. lcd.begin(width, height);Initialize the display and set the size. lcd.print(anything);Print a number or text. This works the same as Serial.print(), but prints to the LCD. lcd.setCursor(x, y);Move the cursor to position (x, y). These are zero-based coordinates. Many other functions are available. See below for links to more details.Example ProgramThis example can be loaded with File > Examples > LiquidCrystal > HelloWorld.// include the library code: #include <LiquidCrystal.h> // 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 rows and columns: 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); } DetailsFor more details, please refer to the official LiquidCrystal page.Custom Character Creator by Druno Maia |