Code for UiFlow-execute block needed for reading and writing the sd-card

  • Hi everyone!
    Using UiFlow V1.3.5-Beta, i'm buliding a hour counter for my boat engine.

    The new timer blocks are great and very helpful, many thanks to the team.

    To store and restore the cumulated seconds i need code for the UiFlow-execute block for reading and writing the sd-card:

    • Is there anyone who can help me?
    • Or are SD-card blocks foreseeen for the next beta version?

    For a first preview of the hour counter here you can see the display content:


    ... translation of the german text:

    • Betriebsstunden = Operating Hours


    • Stunden = Hours
    • Tag = Day
    • Batterie = Battery

    The Button Labeles are in english

  • Hi @Gaviota unfortunately there are no blocks yet to support SD writing. You could try something like this in micropython:

    from m5stack import *
    from m5ui import *
    from uiflow import *
    import os


    timeSinceBoot = None
    f = open("/sd/1.TXT", 'w+')

    while True:
    timeSinceBoot = time.ticks_ms()
    if btnA.wasPressed():

    You may also check this for reference

  • Hi @lukasmaximus thank you for the micropython code.

    This is my test program for writing and reading data to/from SD card:


    Is there a possebility adding files at the posting? then i can add the Blockly-file here.

    And last but not least a short whish list for improvements at UiFlow:

    • Early implementation of the actual UiFlow-Beta-version to the UiFlow-PC-Version
    • Adding remarks in a easy way, i took thererfore the execute block using a #
    • Blocks for handling SD cards (reading, writing, appending data)
    • Adding files in postings at the M5Stack community

  • Hi @Gaviota glad I could be of help. The program looks great
    Unfortunately I don't think there is a way to post files on the forum.
    Other than copying and pasting the micropython output
    The only way is to host the file somewhere and paste the link.

    I would suggest the best way would be if you have a github account
    then make a repository with the file there and share it with us here.
    This would also allow for us to add it to our links of resources.

    Thank you for your requests, I will make sure to hand them on to the dev
    team. It is true that the updates on the offline version are lagging behind
    the online version but we will try to improve this. Blockly allows for a rectractable
    comment from the blocks so this shouldn't be hard to implement

    We used to have blocks for handling the SD card in our old platform M5GO
    so I don't see this as being too difficult to add either.

    All the best, Keep us updated on the progress of your project.