
Once the code has be downloaded to an appropriate folder, and you have your LCD Plate
properly connected, you can start with the basic demo display, which is run by simply
executing the char_lcd_plate.py script in the examples folder:
The example will turn the backlight on to different RGB colors (don't worry if you're using a
monochrome backlight LCD, it is normal to see the backlight turn on and off) and then ask
you to press buttons. As you press different buttons the button name should be printed and
the backlight color changed. Try pressing different buttons to see what happens on the
display.
Press Ctrl-C to quit the program.
Adjusting Contrast
The plate uses a character LCD with an external contrast potentiometer. The first time you
use it, adjust the potentiometer in the bottom right until you see the text clearly. If you don't
upload code to the Pi, some boxes may appear instead, or you may see nothing at all.
Using the library code
Look at the contents of the char_lcd_plate.py file to see the basic usage of the character
LCD plate class. The basic usage is to import the library and create an instance of the
Adafruit_CharLCDPlate class. The char LCD plate class is smart enough to know how to
talk to the character LCD plate without any configuration or parameters.
Once you have an instance of the Adafruit_CharLCDPlate class there are a few functions you
can call to interact with the display:
message(text)
Print the provided string message to the display. The text string can include
linebreak characters ('\n') and will move to the next line when found in the string.
clear()
Clear the display and reset the position of message printing to the first column
and first line.
set_color(red, green, blue)
Set the color of the red, green, and blue backlight LEDs. Each color value should
be a 1 for on or 0 for off. For example to set a red backlight call
set_color(1,0,0) or to set a purple color call set_color(1,0,1).
You can find a more detailed write-up of the library in
this character LCD
guide
(http://adafru.it/dKa)
(see the Usage and Raspberry Pi Char LCD Plate pages).
cd examples
sudo python char_lcd_plate.py
© Adafruit Industries
https://learn.adafruit.com/adafruit-16x2-character-lcd-plus-keypad-for-
raspberry-pi
Page 30 of 32