If you have a rev 2 (512MB) Pi, or if you're not getting anything displaying, it might be due to the
I2C bus number change in the Pi hardware. Edit Adafruit_CharLCD.py using a command like
"nano Adafruit_CharLCD.py" and change the line
lcd = Adafruit_CharLCDPlate(busnum = 0)
to
lcd = Adafruit_CharLCDPlate(busnum = 1)
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
Interfacing with the python example code is fairly easy! Inside the Adafruit_CharLCDPlate folder
you'll find a testLCD.py python script. The script does a few things, at the top it imports all the
sub-modules. You'll need to have the Adafruit_I2C.py, Adafruit_MCP230xx.py and
Adafruit_CharLCDPlate.py python files to be in the same directory so be sure to copy
them to your final destination.
Next it initializes the plate with lcd = Adafruit_CharLCDPlate() - this creates the lcd object
and starts communicating with the plate to set up the LCD and buttons
After initialization, you can clear the display with lcd.clear() and write text with
lcd.message("text goes here") don't forget that its only 16 characters per line, and it
does not automatically wrap lines. To insert a newline use the special '\n' character such as
shown in the command: lcd.message("Adafruit RGB LCD\nPlate w/Keypad!")
Next you can set the backlight with lcd.backlight(lcd.COLORNAME) where COLORNAME
is RED, YELLOW, GREEN, TEAL, BLUE, VIOLET for RGB LCD's or for monochrome LCDs, just use
ON and OFF
Finally, you can ask the plate which buttons are pressed with
buttonPressed(lcd.BUTTONNAME) where BUTTONNAME is LEFT RIGHT UP DOWN or
SELECT. This is not an interrupt-driven library so you can't have an interrupt go off when a
button in pressed, instead you'll have to query the button in a loop.
That's it! If you want to make detailed messages, use the python string formatting commands
to create a string (http://adafru.it/aUi) and then write that string with message()