pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

Unit OLED

案例程序

绘制M5Stack图形

from m5stack import *
from m5ui import *
from uiflow import *
import time
import unit

setScreenColor(0x222222)
oled_1 = unit.get(unit.OLED, unit.PORTA)

while True:
  oled_1.fill(0x000000)
  oled_1.show()
  oled_1.text('Unit OLED Example', 0, 0, 0xffffff)
  oled_1.show()
  wait(5)
  oled_1.fill(0x000000)
  oled_1.show()
  oled_1.image(25, 0, "/flash/img/m5stack.pbm")
  oled_1.show()
  wait(5)
  wait_ms(2)

功能说明

oled_0.fill(0xffffff)
  • 设置屏幕颜色填充
    • White
    • Black
oled_0.fill_rect(0, 0, 0, 0, 0xffffff)
  • 填充规定区域颜色
    • White
    • Black
oled_0.hline(0, 0, 0, 0xffffff)
  • 画横线
    • White
    • Black
oled_0.image(0, 0, "/flash/img/m5stack.pbm")
  • 填充图片
oled_0.invert(1)
  • 设置屏幕翻转
oled_0.line(0, 0, 0, 0, 0xffffff)
  • 绘制横线
    • White
    • Black
oled_0.pixel(0, 0, 0xffffff)
  • 绘制像素
    • White
    • Black
oled_0.poweroff()
  • 关闭电源
oled_0.poweron()
  • 开启电源
oled_0.rect(0, 0, 0, 0, 0xffffff)
  • 绘制方形
    • White
    • Black
oled_0.scroll(0, 0)
  • 滚屏
oled_0.show()
  • 开启Unit
oled_0.text('', 0, 0, 0xffffff)
  • 绘制文本
    • White
    • Black
oled_0.vline(0, 0, 0, 0xffffff)
  • 画垂直线
    • White
    • Black
On This Page