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

    UIFlow Firmware, ToF unit and ampy

    UIFlow
    3
    4
    7.7k
    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.
    • H
      hkubota
      last edited by

      Hi,

      I like the UIFlow firmware as it's a neat way to test small (less than a screen full of code) samples. I don't care about Blocky in particular.
      In short: I like to use MicroPython primarily, but UIFlow secondarily.

      However I cannot make a simple example work though:

      from m5stack import *
      from m5ui import *
      from uiflow import *
      import unit
      
      setScreenColor(0x222222)
      tof0 = unit.get(unit.TOF, unit.PORTA)
      
      for count in range(100):
        lcd.print('        ', 0, 0, 0xffffff)
        lcd.print((tof0.distance), 0, 0, 0xffffff)
        wait(1)
      

      This is the output from a very simply Blocky block. Works fine in the UIFlow UI.
      But sending the same code via ampy does not work: the tof0.distance is always 0. But the screen clearing works just fine.

      Is there a way to send Python code to an M5Stack with UIFlow firmware
      What's the difference between running UIFlow code and the equivalent Python code?

      BTW other examples with other external units work fine. So maybe this problem is limited to the ToF unit...

      ajb2k3A 1 Reply Last reply Reply Quote 0
      • H
        hkubota
        last edited by

        After testing other units, it seems ToF is the only one broken. All the other ones work just fine when copy&pasting the Python code and running via ampy.

        Looks like a bug report is in order.

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

          @hkubota You can send micropython code direct to the M5stack using the download and play buttons.
          I have been doing things this way while testing the TOF with the I2C hub.
          however, a better way is to use Visual Studio. see the video @lukasmaximus uploaded to the M5Stack youtube channel.

          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
          • lukasmaximusL
            lukasmaximus
            last edited by

            The video @ajb2k3 was referring to is here https://www.youtube.com/watch?v=Y9pOWgsNgKk&t=73s hope it helps

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