您好,登录后才能下订单哦!
这篇文章主要介绍“Python的TPYBoard驱动LCD5110脚本怎么写”的相关知识,小编通过实际案例向大家展示操作过程,操作方法简单快捷,实用性强,希望这篇“Python的TPYBoard驱动LCD5110脚本怎么写”文章能帮助大家解决问题。
MicroPython的TPYBoard驱动LCD5110,
先看一下LCD5110针脚含义吧(注意:LCD5110的针脚有些不一样的)
TPYBoard的针脚与5110的针脚对应关系如下:
TPYBoard LCD5110 memo
————————————————————————————
# any Pin => RST Reset pin (0=reset, 1=normal)
# any Pin => CE Chip Enable (0=listen for input, 1=ignore input)
# any Pin => DC Data/Command (0=commands, 1=data)
# MOSI => DIN data flow (Master out, Slave in)
# SCK => CLK SPI clock
# 3V3 or any Pin => VCC 3.3V logic voltage (0=off, 1=on)
# any Pin => LIGHT Light (0=on, 1=off)
# GND => GND
还是看不明白的话,直接上针脚编号吧
TPYBoard LCD5110 memo
————————————————————————————
Y10 => RST Reset pin (0=reset, 1=normal)
Y11 => CE Chip Enable (0=listen for input, 1=ignore input)
Y9 => DC Data/Command (0=commands, 1=data)
X8 => DIN data flow (Master out, Slave in)
X6 => CLK SPI clock
VCC
Y12 => LIGHT Light (0=on, 1=off)
GND
接线ok后,可运行main.py了。
main.py源代码:
import pyb import upcd8544 from machine 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 = upcd8544.PCD8544(SPI, RST, CE, DC, LIGHT) 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()
关于“Python的TPYBoard驱动LCD5110脚本怎么写”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识,可以关注亿速云行业资讯频道,小编每天都会为大家更新不同的知识点。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。