Navigation

    M5Stack Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. AJHANCOCK
    A
    • Continue chat with AJHANCOCK
    • Start new chat with AJHANCOCK
    • Flag Profile
    • Profile
    • Following
    • Followers
    • Blocks
    • Topics
    • Posts
    • Best
    • Groups
    Save
    Saving

    AJHANCOCK

    @AJHANCOCK

    0
    Reputation
    1
    Posts
    162
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    AJHANCOCK Follow

    Posts made by AJHANCOCK

    • TOF Hat does not work with UIFLOW or Micropython simple example

      Re: [UIFlow Firmware](ToF unit and ampy)


      From the published simple example for ToF hat running the Micropython code below:
      from m5stack import *
      from m5ui import *
      from uiflow import *
      import time
      import unit
      setScreenColor(0x000000)
      tof0 = unit.get(unit.TOF, unit.PORTA)
      label0 = M5TextBox(85, 83, "Text", lcd.FONT_DejaVu72, 0x08feab, rotate=0)
      label1 = M5TextBox(227, 174, "mm", lcd.FONT_DejaVu24, 0xFFFFFF, rotate=0)
      label2 = M5TextBox(29, 31, "distance:", lcd.FONT_DejaVu24, 0xFFFFFF, rotate=0)
      while True:
      label0.setText(str(tof0.distance))
      if (tof0.distance) < 300:
      rgb.setColorAll(0xff0000)
      wait(((tof0.distance) / 2000))
      rgb.setColorAll(0x000000)
      wait(((tof0.distance) / 2000))
      speaker.sing(622, 1/16)
      else:
      rgb.setColorAll(0x009900)
      wait_ms(2)

      The statement below fails with error message

      tof0 = unit.get(unit.TOF, unit.PORTA)
      Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "unit.py", line 171, in get
      File "<string>", line 1, in <module>
      File "units/_tof.py", line 5, in init
      File "libs/vl53l0x.py", line 119, in init
      File "libs/vl53l0x.py", line 174, in _available
      Unit: TOF unit maybe not connect

      posted in Bug Report
      A
      AJHANCOCK