Adding external libraries via uiflow



  • By the way, you should be able to follow a similar procedure to load any custom library. Just create the directory /flash/custom and then reference it with sys.path.append('/flash/custom') in boot.py.

    ampy -p /dev/tty.SLAB_USBtoUART -b 115200 mkdir /flash/custom
    ampy -p /dev/tty.SLAB_USBtoUART -b 115200 put customLib.py /flash/custom/customLib.py
    

    in boot.py:

    import sys
    sys.path.append('flowlib/lib')
    sys.path.append('/flash/custom')
    

    Then with uiFlow, you can use the execute block to have the choice when it gets imported (so you don't import it automatically when your program doesn't need it).
    0_1562066480425_Screen Shot 2019-07-02 at 7.20.47 AM.png



  • This post is deleted!


  • Hello, world101 I am very new here in the forum and want to control my M5STACK with "blynk" via UIflow symbols.
    I use:
    UiFlow V1.4.3
    F5STACK fire, the red one.
    blynk for Python v0.2.1 (esp32_LoBo)
    MicroPython ESP32_LoBo_v3.2.24 - 2018-09-06 on M5Stack with ESP32

    I have successfully worked through all the above points.
    However, the dispaly from my M5STACK shows the following error message:

    error
    ImportError("no module named 'uiflow'",)

    I think that I have not installed the above mentioned elements:
    "machine, time, m5base, uiflow"

    In the boot.py I have edited the following, as you have described above:
    import sys
    sys.path.append('flowlib/lib')
    sys.path.append('/flash/blynk')
    import machine, time, m5base, uiflow, BlynkLib

    I would like to implement remote monitoring via iphon of my groundwater pump.
    It would be nice if you could help me, please.



  • @atu said in Adding external libraries via uiflow:

    Hello, world101 I am very new here in the forum and want to control my M5STACK with "blynk" via UIflow symbols.
    I use:
    UiFlow V1.4.3
    F5STACK fire, the red one.
    blynk for Python v0.2.1 (esp32_LoBo)
    MicroPython ESP32_LoBo_v3.2.24 - 2018-09-06 on M5Stack with ESP32

    I have successfully worked through all the above points.
    However, the dispaly from my M5STACK shows the following error message:

    error
    ImportError("no module named 'uiflow'",)

    I think that I have not installed the above mentioned elements:
    "machine, time, m5base, uiflow"

    In the boot.py I have edited the following, as you have described above:
    import sys
    sys.path.append('flowlib/lib')
    sys.path.append('/flash/blynk')
    import machine, time, m5base, uiflow, BlynkLib

    I would like to implement remote monitoring via iphon of my groundwater pump.
    It would be nice if you could help me, please.

    You’re not going to (easily) be able to use LoBo Micropython and the later versions of UIFlow. I think uiFlow v1.2.3 was the latest that LoBo was supported. Best thing would be to flash the official v1.4.4 firmware from M5Stack and use uiFlow v1.4.4.

    Try that first, then try to import the Blynk libs and see if it works.



  • Thank you, world101, for your quick response.
    Now Blynk works at my M5STACK.
    Your Blynk.m5b has five UiFlow blocks for only three virtual functions.
    But Blynk offers much more features.
    Has anyone already generated more UiFLOW blocks they can share?



  • Is this method valid to replace libraries like urequests? I found a "bug" on the current implementation and I would like to replace the one that comes with the UIFlow firmware to workaround the issue. Is that possible or in any other way?
    Thanks!



  • @jesuslg123 If you use a programs like VStudio, Thonny and mu that you can add library directly to the M5Stack



  • @ajb2k3 said in Adding external libraries via uiflow:

    @jesuslg123 If you use a programs like VStudio, Thonny and mu that you can add library directly to the M5Stack

    Thanks, for the this project I was using the UIFlow editor with the UI programming language, do you think I can also replace the urequest version that is using this?
    Also can you share with me how to upload with Visual Studio? Thanks



  • UIFlow is based on Micropython 1.11 so switching isn't that hard.
    Check out https://www.youtube.com/channel/UCozgFVglWYQXbvTmGyS739w luke made a useful vid on it.

    The great thing about UIFlow/Micropython is that you can build most of the program in UIFlow and then switch to Micropython to make final adjustments.
    The only issue is that you can't change back to UIFlow after adjusting because the code blocks won't exist for you added code.



  • If you use Visual Code you could install this extension

    https://marketplace.visualstudio.com/items?itemName=curdeveryday.vscode-m5stack-mpy

    Then transfer your modified library to flash. It would be good to change the name to another one, so that the import function does not load the built-in urequests library. Alternatively, you would have to look in what order and from which locations the libraries are imported.