覆盆子的I?C LCD库
rpi-lcd的Python项目详细描述
此库支持通过I?C转换器显示LCD文本(20x4、16x2和其他)。
它需要在raspberry pi上安装python-smbus包并启用ARM I2C接口。
安装
从pypi:
获取包pip install rpi-lcd
用法
fromrpi_lcdimportLCDfromtimeimportsleeplcd=LCD()lcd.text('Hello World!',1)lcd.text('Raspberry Pi',2)lcd.text('is really',3,'center')lcd.text('awesome',4,'right')sleep(5)lcd.clear()
rpi-lcd处理多行文本:
from rpi_lcd import LCD lcd = LCD() lcd.text('This is a message that has more than 20 chars and does not fit in one line', 1)