Deep Dive: hd44780 Reference
In the example above we created an hd44780_I2Cexp
object called lcd
that was used to control the LCD screen (similar to how we created a Servo
object to control each servo motor in Lab 8). Here are some useful methods that can be used with an hd44780_I2Cexp
object:
Function | Description |
---|---|
begin(w, h) |
Initialize the screen, letting the library know what size it is (ours is 16x2). |
clear() |
Clear the screen. |
print() |
Print a number or text string to the screen. |
setCursor(x, y) |
Move the cursor (where text prints) to position (x, y). The position (0, 0) is the top-left corner of the screen and is where the cursor starts. In the example program, when we use lcd.setCursor(0, 1) at the beginning of loop() , we are moving the cursor to the first character in the second row so that we only need to update that row of the message. |
blink() |
Turn on the blinking cursor. (Initially off.) |
noBlink() |
Turn off the blinking cursor. |
backlight() |
Turn on the backlight. (Initially on.) |
noBacklight() |
Turn off the backlight. |
The full documentation for the LCD library is available here. There are more functions available, although most of them are just for making the contents of the screen scroll as text is printed.
By using the createChar()
function it is possible to create and display your own custom characters on the LCD, although you will have to consult the documentation and library examples to figure out how to use it.