LCD5110
--- LCD5110液晶屏关联功能函数¶
lcd5110
模块的主要功能与函数
功能相关函数¶
-
class
lcd5110.
LCD5110
(spi, rst, ce, dc, light)¶
创建一个LCD5110对象。
spi
pyb.SPI对象rst
pyb.Pin对象ce
pyb.Pin对象dc
pyb.Pin对象light
pyb.Pin对象
-
LCD5110.
clear
()¶
清屏函数,擦除屏幕上所有内容
-
LCD5110.
reset
()¶
复位函数,复位LCD5110
-
LCD5110.
light_on
()¶
打开背光LED
-
LCD5110.
light_off
()¶
关闭背光LED
-
LCD5110.
lcd_write_string
(string, x, y)¶
写字符串函数。
string
显示的字符串x
横向坐标,范围0-83y
纵向坐标,范围0-5
LCD5110与开发板接线对应引脚:¶
TPYBoard LCD5110 Y10 RST Y11 CE Y9 DC Y12 LIGHT X8 DIN X6 CLK GND GND 3.3V 3V3
程序示例:¶
# main.py -- put your code here!
import pyb
import lcd5110
from pyb import SPI,Pin
def main():
SPI = pyb.SPI(1) #DIN=>X8-MOSI/CLK=>X6-SCK
#DIN =>SPI(1).MOSI 'X8' data flow (Master out, Slave in)
#CLK =>SPI(1).SCK 'X6' SPI clock
RST = pyb.Pin('Y10')
CE = pyb.Pin('Y11')
DC = pyb.Pin('Y9')
LIGHT = pyb.Pin('Y12')
lcd_5110 = lcd5110.LCD5110(SPI, RST, CE, DC, LIGHT) #设置LCD5110使用SPI1及其它功能引脚
lcd_5110.lcd_write_string('Hello Python!',0,0)
lcd_5110.lcd_write_string('Micropython',6,1)
lcd_5110.lcd_write_string('TPYBoard',12,2)
lcd_5110.lcd_write_string('v102',60,3)
lcd_5110.lcd_write_string('This is a test of LCD5110',0,4)
if __name__ == '__main__':
main()