Micropython学习交流群 学习QQ群:786510434 提供多种固件下载和学习交流。
Micropython-扇贝物联 QQ群:31324057 扇贝物联是一个让你与智能设备沟通更方便的物联网云平台
Micropython学习交流群 学习QQ群:468985481 学习交流ESP8266、ESP32、ESP8285、wifi模块开发交流、物联网。
Micropython老哥俩的IT农场分享QQ群:929132891 为喜欢科创制作的小白们分享一些自制的计算机软硬件免费公益课程,由两位多年从事IT研发的中年大叔发起。
micropython esp32s3 2.8寸4线SPI串口TFT液晶显示屏模块ILI9341驱动LCD触摸屏 240*320 输出动态特效
"""ILI9341 demo (color palette).""" from time import sleep from ili9341 import Display, color565 from machine import Pin, SPI def hsv_to_rgb(h, s, v): """ Convert HSV to RGB (based on colorsys.py). Args: h (float): Hue 0 to 1. s (float): Saturation 0 to 1. v (float): Value 0 to 1 (Brightness). """ if s == 0.0: return v, v, v i = int(h * 6.0) f = (h * 6.0) - i p = v * (1.0 - s) q = v * (1.0 - s * f) t = v * (1.0 - s * (1.0 - f)) i = i % 6 v = int(v * 255) t = int(t * 255) p = int(p * 255) q = int(q * 255) if i == 0: return v, t, p if i == 1: return q, v, p if i == 2: return p, v, t if i == 3: return p, q, v if i == 4: return t, p, v if i == 5: return v, p, q def test(): """Test code.""" # Baud rate of 40000000 seems about the max #spi = SPI(2,baudrate = 80_000_000, polarity = 0,sck = Pin(18),mosi = Pin(23),miso = Pin(19)) #display = Display(spi,cs = Pin(2,Pin.OUT),dc = Pin(5,Pin.OUT),rst = Pin(4,Pin.OUT),rotation = 180) spi = SPI(1, baudrate=20000000, sck=Pin(4), mosi=Pin(5)) display = Display(spi, dc=Pin(16), cs=Pin(18), rst=Pin(15)) c = 0 while True: for x in range(0, 240, 20): for y in range(0, 320, 20): color = color565(*hsv_to_rgb(c / 192, 1, 1)) display.fill_circle(x + 9, y + 9, 9, color) c += 1 display.clear() #sleep(9) #display.cleanup() test()
完整源码:链接: https://pan.baidu.com/s/1DU0g1bAIRQo8l_Xv9smliQ?pwd=1gjj
提取码: 1gjj 复制这段内容后打开百度网盘手机App,操作更方便哦
淘宝链接:https://item.taobao.com/item.htm?spm=a1z10.5-c.w4002-17584875593.11.5a4e49deQMWcmI&id=654657725650
Copyright © 2014 ESP56.com All Rights Reserved
执行时间: 0.0089728832244873 seconds