menu
Duyuxuan-DeBlog
search
搜索
close
devices
brightness_5
bookmark
home
首页
view_list
分类
keyboard_arrow_down
默认分类
2
access_time
归档
keyboard_arrow_down
2024 年 02 月
2
view_carousel
页面
keyboard_arrow_down
关于
rss_feed
RSS订阅
esp32c3+air101Lcd MicroPython超详细教程指南 点亮tft、bmp彩色图片、五方向按钮!!!
89 浏览 | 2024-02-13 | 阅读时间: 约 1 分钟 | 分类:
默认分类
| 标签:
esp32c3
,
air101lcd
report
请注意,本文编写于 75 天前,最后修改于 75 天前,其中某些信息可能已经过时。
是的没错! 合宙ESP32C3+Air101LCD 理论所有的tft屏幕都同理,Micropython驱动tft不再是坑!!!! # 点亮教程! [esp32c3+air101Lcd用micropython点亮][1] ## 补充 排针下焊时无法直接插入,插入方式如图 ![2024-02-13-21-34-45-900.jpg][2] ![2024-02-13-21-34-50-218.jpg][3] # 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])) ## 快速制作BMP 下载链接:[Image2Lcd2.9.zip][5] ![Snipaste_2024-02-13_21-49-42.png][4] [1]: https://juejin.cn/post/7058147083781406734 [2]: https://dyxblog.110527.xyz/usr/uploads/2024/02/2835275843.jpg [3]: https://dyxblog.110527.xyz/usr/uploads/2024/02/476418503.jpg [4]: https://dyxblog.110527.xyz/usr/uploads/2024/02/1225474449.png [5]: https://dyxblog.110527.xyz/usr/uploads/2024/02/4261991728.zip
Emoji
cancel
OωO
ヾ(≧∇≦*)ゝ
|´・ω・)ノ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
∠( ᐛ 」∠)_
(/ω\)
(๑•̀ㅁ•́ฅ)
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
→_→
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ\"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ\"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
( ๑´•ω•) \"(ㆆᴗㆆ)
(。•ˇ‸ˇ•。)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😏
😒
🙄
😳
😡
😔
😫
😱
😕
🧐
🤭
🤐
💩
👻
🙌
🖕
👍
🌝
🌚
😶
🙏
😣
💊
🍉
🎈
🎁
owo
Emoji
qwq
tieba
huaji
meow
insert_emoticon
发表评论
account_circle
昵称
email
邮箱
web
网址(选填)
insert_emoticon
cancel
发表评论
全部评论
info
还没有任何评论,你来说两句呐!
Duyuxuan
一个有梦想的初中生
最新回复
suyxxjd : OωO (☆ω☆) (☆ω☆)
友情链接
文章目录
arrow_upward