是的没错!
合宙ESP32C3+Air101LCD
理论所有的tft屏幕都同理,Micropython驱动tft不再是坑!!!!
点亮教程!
esp32c3+air101Lcd用micropython点亮 https://juejin.cn/post/7058147083781406734
补充
排针下焊时无法直接插入,插入方式如图


5方向按钮
cen = Pin(4, Pin.OUT,Pin.PULL_UP)
left = Pin(9, Pin.OUT,Pin.PULL_UP)
up = Pin(8, Pin.OUT,Pin.PULL_UP)
down = Pin(5, Pin.OUT,Pin.PULL_UP)
right = Pin(13, Pin.OUT,Pin.PULL_UP)
#注意,如上图,需要使用杜邦线连接,实际引脚请自行决定
BMP图片显示
Micropython代码
tft.rotation(1) #横屏时:
参考相关技术群偏移为:x轴偏移为1,y轴偏移为26,笔者实测 x轴不偏移,y轴偏移24像素。
如果不添加tft.rotation(1) 时:
相关技术群给偏移为:x轴偏移26,y轴偏移1。笔者实测 x轴偏移24像素 y轴不偏移。
以下代码已添加偏移
f=open('test2.bmp', 'rb')
if f.read(2) == b'BM': #header
dummy = f.read(8) #file size(4), creator bytes(4)
offset = int.from_bytes(f.read(4), 'little')
hdrsize = int.from_bytes(f.read(4), 'little')
width = int.from_bytes(f.read(4), 'little')
height = int.from_bytes(f.read(4), 'little')
if int.from_bytes(f.read(2), 'little') == 1: #planes must be 1
depth = int.from_bytes(f.read(2), 'little')
if depth == 24 and int.from_bytes(f.read(4), 'little') == 0:#compress method == uncompressed
print("Image size:", width, "x", height)
rowsize = (width * 3 + 3) & ~3
if height < 0:
height = -height
flip = False
else:
flip = True
w, h = width, height
if w > 80: w = 80
if h > 160: h = 160
tft._setwindowloc((0,24),(w - 1,h +23)) #此处偏移,y轴先下偏移24
for row in range(h):
if flip:
pos = offset + (height - 1 - row) * rowsize
else:
pos = offset + row * rowsize
if f.tell() != pos:
dummy = f.seek(pos)
for col in range(w):
bgr = f.read(3)
tft._pushcolor(TFTColor(bgr[2],bgr[1],bgr[0]))
