🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    M5StickC ToF Hat UIFlow example missing?

    UIFlow
    3
    12
    10.6k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      mb
      last edited by

      I would like to use the ToF Hat with the M5StickC for distance measurement.
      https://docs.m5stack.com/#/en/hat/hat-tof

      The UIFlow example looks a bit short and there is no link to a piece of code.
      UIFlow ToF hat snippet

      UIFlow web has a lot of Hats in the DEMO menu, but this one is missing.

      How can I interface the ToF Hat to show the measured distance on the M5StickC display?

      Thanks
      Mike

      1 Reply Last reply Reply Quote 0
      • ajb2k3A
        ajb2k3
        last edited by

        Nope, that is all that is needed to show values from tof.
        The Get Distance block returns the value from sensor and other blocks handle the data. it is the same for the tof unit.
        https://github.com/Ajb2k3/UIFlowHandbook/blob/master/quickblockref.pdf
        PG197 is for the unit but its almost identicle.

        UIFlow, so easy an adult can learn it!
        If I don't know it, be patient!
        I've ether not learned it or am too drunk to remember it!
        Author of the WIP UIFlow Handbook!
        M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

        1 Reply Last reply Reply Quote 0
        • M
          mb
          last edited by mb

          Thanks for the hint. I forgot to add the ToF Hat in UIFlow with the Hat '+' below the M5StickC.

          alt text

          Now with the simplest program (Setup+Loop), I get an error message when ToF Hat is added:

          Traceback (most recent call last):
            File "flow/m5cloud.py", line 76, in _exec_fun
            File "<string>", line 8, in <module>
            File "hat.py", line 49, in get
            File "<string>", line 1, in <module>
            File "hats/_tof.py", line 9, in __init__
          AttributeError: 'module' object has no attribute 'init'
          

          When I remove the ToF Hat it runs again.

          Do I need to install anything? Using UIFlow v1.6.5 (web and firmware)

          ajb2k3A 1 Reply Last reply Reply Quote 0
          • ajb2k3A
            ajb2k3 @mb
            last edited by

            @mb You haven't added any functions to the loop and so it cant initialise the TOF hat.
            Once you add a function block and the get distance block like in the example then the micropython init code will be added.

            UIFlow, so easy an adult can learn it!
            If I don't know it, be patient!
            I've ether not learned it or am too drunk to remember it!
            Author of the WIP UIFlow Handbook!
            M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

            1 Reply Last reply Reply Quote 0
            • M
              mb
              last edited by

              The pure "Setup-Loop" block is running fine - as long as I do not add the ToF Hat.

              Now I have a loop block with functions inside, which works fine.

              alt text

              When adding the ToF Hat (just in the configuration) it breaks, I see a Traceback.

              alt text

              Even with ToF Hat and ToF function it does not work.

              alt text

              Traceback (most recent call last):
                File "flow/m5cloud.py", line 76, in _exec_fun
                File "<string>", line 9, in <module>
                File "hat.py", line 49, in get
                File "<string>", line 1, in <module>
                File "hats/_tof.py", line 9, in __init__
              AttributeError: 'module' object has no attribute 'init'
              

              I am using UIFlow v1.6.5 (web and firmware).

              Has anyone the M5StickC with ToF Hat up and running? And can share the code?

              ajb2k3A 1 Reply Last reply Reply Quote 0
              • ajb2k3A
                ajb2k3 @mb
                last edited by

                @mb well that is strange

                UIFlow, so easy an adult can learn it!
                If I don't know it, be patient!
                I've ether not learned it or am too drunk to remember it!
                Author of the WIP UIFlow Handbook!
                M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

                1 Reply Last reply Reply Quote 0
                • M
                  mb
                  last edited by

                  Maybe @m5stack can have a look. Is this a bug with v1.6.5?

                  m5stackM 1 Reply Last reply Reply Quote 0
                  • m5stackM
                    m5stack @mb
                    last edited by

                    @mb this is a bug. we will fix it in the next version

                    M 1 Reply Last reply Reply Quote 0
                    • M
                      mb @m5stack
                      last edited by

                      Thanks @m5stack. Will this be hours, days, weeks or months?

                      Just so I know when I can move my project forward.

                      m5stackM 1 Reply Last reply Reply Quote 0
                      • m5stackM
                        m5stack @mb
                        last edited by

                        @mb already fixed. you could use the new firmware version M5StickC UIFlow 1.6.5.1

                        1 Reply Last reply Reply Quote 0
                        • M
                          mb
                          last edited by

                          Awesome @m5stack, thank you!

                          1 Reply Last reply Reply Quote 0
                          • M
                            mb
                            last edited by

                            M5StickC and ToF Hat work great with firmware UIFlow 1.6.5.1 :)

                            alt text

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post