回到首页 返回首页
回到顶部 回到顶部
返回上一页 返回上一页

【雕爷学编程】MicroPython动手做(02)——尝试搭建K210开发板的IDE环境5 中等

头像 驴友花雕 2023.07.28 80 2

#尝试搭建K210的Micropython开发环境(Win10)
#实验程序之三:更新频率演示

代码
#尝试搭建K210的Micropython开发环境(Win10)
#实验程序之三:更新频率演示

from Maix import freq

cpu_freq, kpu_freq = freq.get()
print(cpu_freq, kpu_freq)

freq.set(cpu = 400, pll1=400, kpu_div = 1)

08.jpg

#尝试搭建K210的Micropython开发环境(Win10)
#实验程序之四:LCD屏显示"hello maixpy"

 

 

代码
#尝试搭建K210的Micropython开发环境(Win10)
#实验程序之四:LCD屏显示"hello maixpy"

import lcd, time
import image

bg = (236,36,36)
lcd.init(freq=15000000)
lcd.direction(lcd.YX_RLDU)
lcd.clear(lcd.RED)
time.sleep(1)
lcd.draw_string(120, 120, "hello maixpy", lcd.WHITE, lcd.RED)
time.sleep(2)


img = image.Image()
img.draw_string(60, 100, "hello maixpy", scale=2)
img.draw_rectangle((120,120,30,30))
lcd.display(img)

09.jpg
10.jpg
12.gif

27 (2).jpg

#尝试搭建K210的Micropython开发环境(Win10)
#实验程序之五:LCD液晶显示器彩条测试

代码
#尝试搭建K210的Micropython开发环境(Win10)
#实验程序之五:LCD液晶显示器彩条测试

import lcd,image, time


lcd.init(type=1, freq=15000000)
# lcd.init(type=2, freq=20000000)
# lcd.init(type=1, width=320, height=240, invert=True, freq=20000000)

img = image.Image(size=(240,240))

img.draw_rectangle(0,0,30, 240, fill=True, color=(0xff, 0xff, 0xff))
img.draw_rectangle(30,0,30, 240, fill=True, color=(250, 232, 25))
img.draw_rectangle(60,0,30, 240, fill=True, color=(106, 198, 218))
img.draw_rectangle(90,0,30, 240, fill=True, color=(98, 177, 31))
img.draw_rectangle(120,0,30, 240, fill=True, color=(180, 82, 155))
img.draw_rectangle(150,0,30, 240, fill=True, color=(231, 47, 29))
img.draw_rectangle(180,0,30, 240, fill=True, color=(32, 77, 158))
img.draw_rectangle(210,0,30, 240, fill=True, color=(27, 28, 32))

lcd.display(img)

count = 500
while count > 0:
    t = time.ticks_ms()
    lcd.display(img)
    print(time.ticks_ms() - t)
    count -= 1

13.jpg
14.jpg

评论

user-avatar
  • 伦**

    伦**2024.03.20

    666

    0
    • hacker_

      hacker_2023.07.28

      666

      0
      icon 他的勋章
        展开更多