RTC example for the M5Stack



  • Does anyone have a running RTC example for the M5Stack what about UiFlow?
    This is mine what I use on my Wipy but don't want to run on the M5Stack.

                #rtc.ntp_sync("de.pool.ntp.org", update_period=3600) # Datum und Uhrzeit holen
                rtc.ntp_sync("de.pool.ntp.org")
                while not rtc.synced():
                    machine.idle() # save power while waiting
    
    
                utime.timezone(TimeDiff)
                time1 = utime.localtime() # Übergabe Datum und Uhrzeit in die Variable time1
    
                #time1 = rtc.now() # Übergabe Datum und Uhrzeit in die Variable time1
                startzeit = time.time()
    
                LogDateTime = "{}.{:}.{:};{:0>2d}:{:0>2d}:{:0>2d}".format(time1[2], time1[1], time1[0], time1[3], time1[4], time1[5])
                LogDate = "{}.{:}.{:}".format(time1[2], time1[1], time1[0])
                LogTime = "{:0>2d}:{:0>2d}:{:0>2d}".format(time1[3], time1[4], time1[5])
                break

  • M5Stack

    Hi @Wolli01 Only M5StickC has built in RTC. M5Stack only supports NTP, but RTC requires an external module



  • And how can I use NTP in MicroPython to get the time?