pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

Unit UWB

Example

The Anchor mode is used to fix as an anchor point

from m5stack import *
from m5ui import *
from uiflow import *
import unit

setScreenColor(0x222222)
uwb_0 = unit.get(unit.UWB, unit.PORTC)

uwb_0.init_uwb_mode(0)
uwb_0.set_mode(0)
while True:
  if uwb_0.check_device:
    print((str('distance') + str((uwb_0.device_id))))
  wait_ms(2)

Tag mode, move points, get positioning

from m5stack import *
from m5ui import *
from uiflow import *
import unit

setScreenColor(0x222222)
uwb_0 = unit.get(unit.UWB, unit.PORTC)

uwb_0.init_uwb_mode()
uwb_0.set_mode()
while True:
  if uwb_0.check_device:
    print((str('distance') + str((uwb_0.get_distance_measure[0]))))
  wait_ms(2)

API

uwb_0.init_uwb_mode()
  • Initializes Unit and sets the running mode
    • tag: indicates the tag mode
    • Anchor: indicates the anchor mode
uwb_0.uart_port_id(1)
  • Set the component ID number
print(uwb_0.check_device)
  • Check whether the device is available
uwb_0.continuous_output_value(0)
  • Continuous value output output
    • Enable
    • Disable
print(uwb_0.device_id)
  • Get device ID
print(uwb_0.get_distance_measure[0])
  • Get the distance to the anchor point
print(uwb_0.get_version())
  • Obtain the current firmware version
uwb_0.set_mode(0)
  • Set the anchor mode ID value
uwb_0.set_range_interval(5)
  • Set the interval for obtaining data
uwb_0.set_mode()
  • Set label mode
uwb_0.update_new_value_loop()
  • Update distance value
On This Page