MiniOLED Unit
MiniOLED UNIT is a 0.42-inch I2C interface OLED screen unit, it’s a 72*40, monochrome white display.
Support the following products:
UiFlow2 Example
Draw Text
Open the cores3_minioled_example.m5f2 project in UiFlow2.
This example displays the text “Mini” on the screen.
UiFlow2 Code Block:
Example output:
None
MicroPython Example
Draw Text
This example displays the text “Mini” on the screen.
MicroPython Code Block:
1# SPDX-FileCopyrightText: 2024 M5Stack Technology CO LTD 2# 3# SPDX-License-Identifier: MIT 4 5import os, sys, io 6import M5 7from M5 import * 8from hardware import I2C 9from hardware import Pin 10from unit import MiniOLEDUnit 11 12 13label0 = None 14label1 = None 15i2c0 = None 16minioled_0 = None 17 18 19def setup(): 20 global label0, label1, i2c0, minioled_0 21 22 M5.begin() 23 Widgets.fillScreen(0x222222) 24 label0 = Widgets.Label("CoreS3", 127, 109, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18) 25 26 i2c0 = I2C(0, scl=Pin(1), sda=Pin(2), freq=100000) 27 minioled_0 = MiniOLEDUnit(i2c0, 0x3C) 28 label1 = Widgets.Label( 29 "Mini", 15, 9, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18, minioled_0 30 ) 31 32 33def loop(): 34 global label0, label1, i2c0, minioled_0 35 M5.update() 36 37 38if __name__ == "__main__": 39 try: 40 setup() 41 while True: 42 loop() 43 except (Exception, KeyboardInterrupt) as e: 44 try: 45 from utility import print_error_msg 46 47 print_error_msg(e) 48 except ImportError: 49 print("please update to latest firmware")
Example output:
None
API
class MiniOLEDUnit
- class unit.minioled.MiniOLEDUnit(i2c, address=60)
Bases:
objectInitialize the Mini OLED Unit.
- Parameters:
i2c (I2C | PAHUBUnit) – The I2C bus the Mini OLED Unit is connected to.
address (int) – The I2C address of the Mini OLED Unit, default is 0x3C.
UiFlow2 Code Block:

MicroPython Code Block:
from unit import MiniOLEDUnit minioled_0 = MiniOLEDUnit(i2c0, 0x3c)
MiniOLEDUnit class inherits Display class, See hardware.Display for more details.

