Micropython学习交流群 学习QQ群:786510434 提供多种固件下载和学习交流。
Micropython-扇贝物联 QQ群:31324057 扇贝物联是一个让你与智能设备沟通更方便的物联网云平台
Micropython学习交流群 学习QQ群:468985481 学习交流ESP8266、ESP32、ESP8285、wifi模块开发交流、物联网。
Micropython老哥俩的IT农场分享QQ群:929132891 为喜欢科创制作的小白们分享一些自制的计算机软硬件免费公益课程,由两位多年从事IT研发的中年大叔发起。
中景园2.08寸OLED SH1122 带字库芯片 GT30L32S4W
from machine import Pin, SoftSPI from sh1122 import SH1122_SPI import framebuf import time from GT30L import GT30L32S4W import fonttrans spi=SoftSPI(baudrate=5000000, sck=Pin(23), mosi=Pin(22),miso=Pin(18)) oled = SH1122_SPI(256, 64, spi, dc=Pin(26, Pin.OUT), res=Pin(25, Pin.OUT), cs=Pin(27, Pin.OUT)) fontlib=GT30L32S4W(spi,cs=Pin(5, Pin.OUT)) chstr=b'\xce\xd2\xbf\xcf\xb6\xa8\xd4\xda\xbc\xb8\xb0\xd9\xc4\xea\xc7\xb0\xbe\xcd\xcb\xb5\xb9\xfd\xb0\xae\xc4\xe3' chstr2=b'\xd6\xbb\xca\xc7\xc4\xe3\xcd\xfc\xc1\xcb\xce\xd2\xd2\xb2\xc3\xbb\xbc\xc7\xc6\xf0' chstr3=b'\xd7\xdf\xb9\xfd\xc2\xb7\xb9\xfd\xc3\xbb\xd3\xf6\xb9\xfd' chstr4=b'\xbb\xd8\xcd\xb7\xd7\xaa\xcd\xb7\xbb\xb9\xca\xc7\xb4\xed' def showch(x,y,s,scale): length=len(s) fball=framebuf.FrameBuffer(bytearray(16*length*8), 16*length, 16, framebuf.GS4_HMSB) chlist=[] for i in range(0,length,2): m=s[i] l=s[i+1] chlist.append(m*256+l) xreal=x for s in chlist: xreal+=16 fb=fonttrans.show_16x16(fontlib.gb2312_16x16(s),scale) fball.blit(fb,xreal,y) oled.blit(fball,x,y) oled.show() def showlyrics(y,s,scale): length=len(s) fball=framebuf.FrameBuffer(bytearray(16*length*8), 16*length, 16, framebuf.GS4_HMSB) chlist=[] for i in range(0,length,2): m=s[i] l=s[i+1] chlist.append(m*256+l) x=int((256-16*length/2-16)/2) xreal=0 for s in chlist: xreal+=16 fb=fonttrans.show_16x16(fontlib.gb2312_16x16(s),scale) fball.blit(fb,xreal,0) oled.blit(fball,x,y) oled.show() showlyrics(0,chstr,15) showlyrics(16,chstr2,15) showlyrics(32,chstr3,15) showlyrics(48,chstr4,15)
来源:https://jd3096.blog.csdn.net/article/details/127206443?spm=1001.2014.3001.5502
Copyright © 2014 ESP56.com All Rights Reserved
执行时间: 0.0098910331726074 seconds