Micropython学习交流群 学习QQ群:786510434 提供多种固件下载和学习交流。

Micropython-扇贝物联 QQ群:31324057 扇贝物联是一个让你与智能设备沟通更方便的物联网云平台

Micropython学习交流群 学习QQ群:468985481 学习交流ESP8266、ESP32、ESP8285、wifi模块开发交流、物联网。

Micropython老哥俩的IT农场分享QQ群:929132891 为喜欢科创制作的小白们分享一些自制的计算机软硬件免费公益课程,由两位多年从事IT研发的中年大叔发起。

Micropython ESP频道

micropython esp32 2.4寸4线SPI串口屏高清TFT液晶彩屏模块 ILI9341


2.4寸4线SPI串口屏高清TFT液晶彩屏模块 ILI9341

Snipaste_2023-07-02_12-07-52.png

Snipaste_2023-07-02_12-06-55.png

Snipaste_2023-07-02_12-08-01.png

QQ图片20230702120623.jpg

Snipaste_2023-07-02_12-09-45.png

"""ILI9341 demo (fonts)."""
from time import sleep
from ili9341 import Display, color565
from machine import Pin, SPI
from xglcd_font import XglcdFont


def test():
    """Test code."""
    # Baud rate of 40000000 seems about the max
    
    #这里接线是ESP32S3 
    spi = SPI(1, baudrate=40000000, sck=Pin(4), mosi=Pin(5),miso=Pin(6))
    display = Display(spi, dc=Pin(16), cs=Pin(17), rst=Pin(15),rotation=270)

    print('Loading fonts...')
    print('Loading arcadepix')
    arcadepix = XglcdFont('fonts/ArcadePix9x11.c', 9, 11)
    print('Loading bally')
    bally = XglcdFont('fonts/Bally7x9.c', 7, 9)
    print('Loading broadway')
    broadway = XglcdFont('fonts/Broadway17x15.c', 17, 15)
    print('Loading espresso_dolce')
    espresso_dolce = XglcdFont('fonts/EspressoDolce18x24.c', 18, 24)
    print('Loading fixed_font')
    fixed_font = XglcdFont('fonts/FixedFont5x8.c', 5, 8)
    print('Loading neato')
    #neato = XglcdFont('fonts/Neato5x7.c', 5, 7, letter_count=223)
    #print('Loading robotron')
    robotron = XglcdFont('fonts/Robotron13x21.c', 13, 21)
    print('Loading unispace')
    unispace = XglcdFont('fonts/Unispace12x24.c', 12, 24)
    print('Loading wendy')
    wendy = XglcdFont('fonts/Wendy7x8.c', 7, 8)
    print('Fonts loaded.')





    while True:
        display.clear()
        display.draw_text(0, 0, 'Arcade Pix 9x11', arcadepix, color565(255, 0, 0))
        display.draw_text(0, 22, 'Bally 7x9', bally, color565(0, 255, 0))
        display.draw_text(0, 43, 'Broadway 17x15', broadway, color565(0, 0, 255))
        display.draw_text(0, 66, 'Espresso Dolce 18x24', espresso_dolce,
                          color565(0, 255, 255))
        display.draw_text(0, 104, 'Fixed Font 5x8', fixed_font,
                          color565(255, 0, 255))
        #display.draw_text(0, 125, 'Neato 5x7', neato, color565(255, 255, 0))
        display.draw_text(0, 155, 'ROBOTRON 13X21', robotron,
                          color565(255, 255, 255))
        display.draw_text(0, 190, 'Unispace 12x24', unispace,
                          color565(255, 128, 0))
        display.draw_text(0, 220, 'Wendy 7x8', wendy, color565(255, 0, 128))

        sleep(5)
        display.clear()

        display.draw_text(0, 255, 'Arcade Pix 9x11', arcadepix,
                          color565(255, 0, 0),
                          landscape=True)
        display.draw_text(22, 255, 'Bally 7x9', bally, color565(0, 255, 0),
                          landscape=True)
        display.draw_text(43, 255, 'Broadway 17x15', broadway, color565(0, 0, 255),
                          landscape=True)
        display.draw_text(66, 255, 'Espresso Dolce 18x24', espresso_dolce,
                          color565(0, 255, 255), landscape=True)
        display.draw_text(104, 255, 'Fixed Font 5x8', fixed_font,
                          color565(255, 0, 255), landscape=True)
        #display.draw_text(125, 255, 'Neato 5x7', neato, color565(255, 255, 0),landscape=True)
        display.draw_text(155, 255, 'ROBOTRON 13X21', robotron,
                          color565(255, 255, 255),
                          landscape=True)
        display.draw_text(190, 255, 'Unispace 12x24', unispace,
                          color565(255, 128, 0),
                          landscape=True)
        display.draw_text(220, 255, 'Wendy 7x8', wendy, color565(255, 0, 128),
                          landscape=True)

        sleep(5)
        display.clear()

        display.draw_text(0, 0, '------Arcade Pix 9x11------', arcadepix, color565(255, 0, 0),
                          background=color565(0, 255, 255))
        display.draw_text(0, 22, 'Bally 7x9', bally, color565(0, 255, 0),
                          background=color565(0, 0, 128))
        display.draw_text(0, 43, 'Broadway', broadway, color565(0, 0, 255),
                          background=color565(255, 255, 0))
        display.draw_text(0, 66, 'Espresso', espresso_dolce,
                          color565(0, 255, 255), background=color565(255, 0, 0))
        display.draw_text(0, 104, 'Fixed Font 5x8', fixed_font,
                          color565(255, 0, 255), background=color565(0, 128, 0))
        #display.draw_text(0, 125, 'Neato 5x7', neato, color565(255, 255, 0),background=color565(0, 0, 255))
        display.draw_text(0, 155, 'ROBOTRON 13X21', robotron,
                          color565(255, 255, 255),
                          background=color565(128, 128, 128))
        display.draw_text(0, 190, 'Unispace', unispace, color565(255, 128, 0),
                          background=color565(0, 128, 255))
        display.draw_text(0, 220, 'Wendy 7x8', wendy, color565(255, 0, 128),
                          background=color565(255, 255, 255))

        sleep(5)
        #display.cleanup()


test()


屏幕购买链接:https://item.taobao.com/item.htm?spm=a1z09.2.0.0.3a3a2e8dKTvm8y&id=655224811014&_u=21tfoi0pc216


源码下载:https://github.com/rdagger/micropython-ili9341



推荐分享
图文皆来源于网络,内容仅做公益性分享,版权归原作者所有,如有侵权请告知删除!
 

Copyright © 2014 ESP56.com All Rights Reserved

执行时间: 0.0091469287872314 seconds