import os, sys, io import M5 from M5 import * from hardware import sdcard label0 = None def setup(): global label0 M5.begin() Widgets.fillScreen(0x222222) label0 = Widgets.Label("label0", 21, 46, 1.0, 0xffffff, 0x222222, Widgets.FONTS.DejaVu18) sdcard.SDCard(slot=2, width=1, sck=18, miso=19, mosi=23, cs=4, freq=1000000) label0.setText(str(os.listdir('/sd/'))) def loop(): global label0 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")