English
English
简体中文
日本語

UiFlow Tutorial

UiFlow1 Development Guide

Project Management

Use LTE network

UiFlow1 Blockly

Event

Unit

Hat ToF

Example

Retrieves and prints the distance value from the sensor.

from m5stack import *
from m5ui import *
from uiflow import *
import hat

setScreenColor(0x111111)

hat_tof_0 = hat.get(hat.TOF)

while True:
  print(hat_tof_0.GetDistance())
  wait_ms(2)

API

hat_tof_0.GetDistance()
  • Retrieves the distance data measured by the sensor.
Page Tools
PDF
On This Page