Release date: 2014 Dec 11
This is a C++ library for the Arduino IDE that allows you to control an LCD that uses the Hitachi HD44780 protocol. This library is very similar to the LiquidCrystal library, but it provides more separation between the low-level hardware access functions and the high-level functions so that the low-level functions can be replaced if necessary.
This library assumes that you have the RS, E, DB4, DB5. DB6, and DB7 pins of the LCD connected to your microcontroller, and that the RW pin is pulled low. With this configuration, it is not possible to poll the LCD's busy flag, so blocking delays are used after each command in order to give it time to complete.
This library was designed to be used with the Arduino IDE versions 1.0.x or 1.5.x and will probably not work with earlier versions.
This library should work with any board that can be programmed by those versions of the Arduino IDE.
Download the pololu-hd44780-arduino library from GitHub, decompress it, and drag the "PololuHD44780" folder into the "libraries" subdirectory inside your Arduino sketchbook directory. You can view your sketchbook location by selecting File->Preferences in the Arduino environment. If there is not already a "libraries" folder in that location, you should create it yourself. After installing the library, restart the Arduino environment. Example code for using this library can be found in the File->Examples menu.
Unless you are using a library that creates an LCD object for you in some way, you will want to create a PololuHD44780 object that can be used to access your LCD. To do so, add these lines near the top of your sketch:
The numbers listed above are the pin numbers for the pins that are controlling the LCD. The pins are specified in this order: RS, E, DB4, DB5, DB6, DB7.
To clear your LCD's screen, use
To print strings and numbers to it, you can use
Serial object and can print a lot of different things. See the Arduino print() documentation for more information, or look at the overloads of print that are defined in Print.h in the Arduino IDE source code.
To control where data is printed on the LCD, you can use
gotoXY(). The following code positions the cursor on the first column (column 0) of the second line (line 1):
If you call these functions too often in a tight loop, your LCD might flicker and be hard to read. Here is some code that waits at least 100 milliseconds between writes to the LCD: