I know this isn't referencing the hardware schematic, but I thought I'd chime in.
I just put mine together last week, and made a quickie script for outputting messages (especially background tasks) from shell scripts. It uses the Adafruit_CharLCDPlate library module.
- Code: Select all
#!/usr/bin/python
import sys
from Adafruit_CharLCDPlate import Adafruit_CharLCD
if __name__ == '__main__':
lcd = Adafruit_CharLCD(15, 13, [12,11,10,9], 14)
# take command line arguments, except the script name
argv = sys.argv
argv.pop(0)
text = ''
# all given arguments are to be printed
while argv:
arg = argv.pop(0)
# parse for some special characters
while len(arg):
c = arg[0] ; arg = arg[1:]
# form feed or vertical tab to clear the screen
if c == '\f' or c == '\v':
lcd.clear()
text = ''
# backspace undoes one plain character
elif c == '\b':
text = text[:-1]
# escape (\e in bash) a color number
elif c == chr(033):
if text:
lcd.message(text)
text = ''
if arg[0] in '01234567':
color = ord(arg[0])-ord('0')
lcd.backlight(color)
if color == 0:
lcd.backlight(lcd.OFF)
lcd.noDisplay()
arg = arg[1:]
else:
text += c
# print any remaining text after last special code
if text:
lcd.message(text)
You can add this in a bootup script, so it runs even when the Pi is headless. Create this file as /etc/init.d/lcdready, then symlink it as /etc/rc0.d/S90lcdready. Set them both executable. Be sure you've installed i2c-tools and the Adafruit libraries, and adjusted the PYTHONPATH for the location of those *.py files.
- Code: Select all
export PYTHONPATH=/home/pi/lib
i2cget -y 1 0x20 && /home/pi/bin/lcdecho $'\e2Ready.'
The i2cget command is used to detect whether the LCD plate is installed at address 0x20, before trying to squirt text to it. This isn't entirely necessary, since it won't hurt anything, but I like to be proper. (For an older Pi, you want the bus zero, with i2cget -y 0, not -y 1.)
[ e d @ h a l l e y . c c ]