Atomic Display Base
The is the class of the Atomic Display Base, which is used to display images and text on the screen.
Support the following products:
Below is the detailed support for Atomic Display Base on the host:
Controller |
Status |
|---|---|
Atom Echo |
⭕ |
Atom Lite |
✅ |
Atom Matrix |
✅ |
AtomS3 |
✅ |
AtomS3 Lite |
✅ |
AtomS3R |
✅ |
AtomS3R-CAM |
✅ |
AtomS3R-Ext |
✅ |
✅: Supported.
⭕: Optional, It conflicts with some internal resource of the host.
UiFlow2 Example
Draw Text
Open the atoms3_draw_text_example.m5f2 project in UiFlow2.
This example displays the text “M5Stack” on the screen.
UiFlow2 Code Block:
Example output:
None
Draw Image
Open the atoms3_draw_text_example.m5f2 project in UiFlow2.
This example displays the image on the screen.
UiFlow2 Code Block:
Example output:
None
MicroPython Example
Draw Text
This example displays the text “M5Stack” on the screen.
MicroPython Code Block:
1# SPDX-FileCopyrightText: 2025 M5Stack Technology CO LTD 2# 3# SPDX-License-Identifier: MIT 4 5import os, sys, io 6import M5 7from M5 import * 8from base import AtomicDisplayBase 9 10 11label0 = None 12label1 = None 13base_display = None 14 15 16def setup(): 17 global label0, label1, base_display 18 19 M5.begin() 20 label1 = Widgets.Label("M5Stack", 23, 53, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18) 21 22 base_display = AtomicDisplayBase( 23 width=1280, 24 height=720, 25 refresh_rate=60, 26 output_width=1280, 27 output_height=720, 28 scale_w=1, 29 scale_h=1, 30 pixel_clock=74250000, 31 ) 32 label0 = Widgets.Label( 33 "M5STACK", 466, 318, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu72, base_display 34 ) 35 36 37def loop(): 38 global label0, label1, base_display 39 M5.update() 40 41 42if __name__ == "__main__": 43 try: 44 setup() 45 while True: 46 loop() 47 except (Exception, KeyboardInterrupt) as e: 48 try: 49 from utility import print_error_msg 50 51 print_error_msg(e) 52 except ImportError: 53 print("please update to latest firmware")
Example output:
None
Draw Image
This example displays the image on the screen.
MicroPython Code Block:
# SPDX-FileCopyrightText: 2025 M5Stack Technology CO LTD # # SPDX-License-Identifier: MIT import os, sys, io import M5 from M5 import * from base import AtomicDisplayBase image0 = None image1 = None base_display = None def setup(): global image0, image1, base_display M5.begin() image0 = Widgets.Image("res/img/default.jpg", 51, 51, scale_x=1, scale_y=1) base_display = AtomicDisplayBase( width=1280, height=720, refresh_rate=60, output_width=1280, output_height=720, scale_w=1, scale_h=1, pixel_clock=74250000, ) image1 = Widgets.Image( "res/img/default.jpg", 443, 213, scale_x=10, scale_y=10, parent=base_display ) image0.setImage("res/img/default.jpg") image1.setImage("res/img/default.jpg") def loop(): global image0, image1, base_display M5.update() if __name__ == "__main__": try: setup() while True: loop() except (Exception, KeyboardInterrupt) as e: try: from utility import print_error_msg print_error_msg(e) except ImportError: print("please update to latest firmware")
Example output:
None
API
AtomicDisplayBase
- class base.display.AtomicDisplayBase(width=1280, height=720, refresh_rate=60, output_width=1280, output_height=720, scale_w=1, scale_h=1, pixel_clock=74250000)
Bases:
objectInitialize the Atomic Display Base.
- Parameters:
width (int) – The logical width of the Atomic Display Base. Default is 1280px.
height (int) – The logical height of the Atomic Display Base. Default is 720px.
refresh_rate (int) – The refresh rate of the Atomic Display Base. Default is 60Hz.
output_width (int) – The width of the output of the Atomic Display Base. Default is 1280px.
output_height (int) – The height of the output of the Atomic Display Base. Default is 720px.
scale_w (int) – The scale width of the Atomic Display Base. Default is 1.
scale_h (int) – The scale height of the Atomic Display Base. Default is 1.
pixel_clock (int) – The pixel clock of the Atomic Display Base. Default is 74250000.
UiFlow2 Code Block:

MicroPython Code Block:
from base import AtomicDisplayBase atom_display = AtomicDisplayBase(1280, 720, 60, 1280, 720, 1, 1, 74250000)




