pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

Atomic Base

UIFlow 1.0 Project

Unit OLED

Example

Draw the M5Stack graph

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)

API

oled_0.fill(0xffffff)
  • Set screen color fill
    • White
    • Black
oled_0.fill_rect(0, 0, 0, 0, 0xffffff)
  • Fill a specified area with color
    • White
    • Black
oled_0.hline(0, 0, 0, 0xffffff)
  • Draw a horizontal line
    • White
    • Black
oled_0.image(0, 0, "/flash/img/m5stack.pbm")
  • Fill with an image
oled_0.invert(1)
  • Set screen rotation
oled_0.line(0, 0, 0, 0, 0xffffff)
  • Draw a horizontal line
    • White
    • Black
oled_0.pixel(0, 0, 0xffffff)
  • Draw a pixel
    • White
    • Black
oled_0.poweroff()
  • Turn off power
oled_0.poweron()
  • Turn on power
oled_0.rect(0, 0, 0, 0, 0xffffff)
  • Draw a rectangle
    • White
    • Black
oled_0.scroll(0, 0)
  • Scroll the screen
oled_0.show()
  • Activate Unit
oled_0.text('', 0, 0, 0xffffff)
  • Draw text
    • White
    • Black
oled_0.vline(0, 0, 0, 0xffffff)
  • Draw a vertical line
    • White
    • Black
On This Page