If you aren't familiar with the character LCD plate, make sure to first read the guide on its usage.
To use this character LCD library with the plate, make sure the library is installed by following the steps on the usage page. Then connect the LCD plate to your Raspberry Pi and execute the char_lcd_plate.py script in the library's examples folder:
sudo python char_lcd_plate.py
When you run the example you should see the backlight run through different colors, and then the display will tell you to press buttons. If you press different buttons on the LCD plate you should see the button name and a different color displayed. Try pressing buttons to see how the script reacts!
Examine the code for the char_lcd_plate.py script to see how to use the character LCD plate code. The usage of the LCD plate is very similar to RGB or monochrome LCD usage, with a few key differences.
The first difference is that you create and instance of the Adafruit_CharLCDPlate class. You don't need to pass any parameters in to this class' constructor/init function because it is preconfigured for the LCD plate.
# Initialize the LCD using the pins lcd = LCD.Adafruit_CharLCDPlate()
For example to check if the select button is pressed you can call is_presssed(LCD.SELECT), or to check if the right button is pressed you can call is_pressed(LCD.RIGHT).
# Make list of button value, text, and backlight color. buttons = ( (LCD.SELECT, 'Select', (1,1,1)), (LCD.LEFT, 'Left' , (1,0,0)), (LCD.UP, 'Up' , (0,0,1)), (LCD.DOWN, 'Down' , (0,1,0)), (LCD.RIGHT, 'Right' , (1,0,1)) ) print 'Press Ctrl-C to quit.' while True: # Loop through each button and check if it is pressed. for button in buttons: if lcd.is_pressed(button[0]): # Button is pressed, change the message and backlight. lcd.clear() lcd.message(button[1]) lcd.set_color(button[2][0], button[2][1], button[2][2])
That's all there is to using the character LCD plate with the character LCD Python library!